The Right function in PowerApps is used to extract a specified number of characters from the end of a text string. This is particularly useful when you need to get a substring from the end of a string.
PowerApps – Right() function Syntax
Right(Text, NumberOfCharacters)
- Text: The string from which you want to extract characters.
- NumberOfCharacters: The number of characters you want to extract from the end of the string.
PowerApps - Basic Example of Right function
This returns "Apps" because it extracts the last 4 characters from the string "PowerApps".
If you have a filename and you want to extract the file extension:
This returns "pdf".
PowerApps – get last 5 characters from the input text
If you have a text input control named TextInput1 and you want to get the last 5 characters entered by the user:
Right(TextInput1.Text, 5)
If you have a list of user IDs and you need to extract the last 4 digits:
PowerApps - Get Last N Characters Based on a Condition
If you want to extract characters based on a dynamic condition, such as a slider value:
Right("DynamicLength", Slider1.Value)
Here, the number of characters extracted from "DynamicLength" is determined by the value of Slider1.
PowerApps – Get the domain name from the email address
Suppose you have a gallery with a list of email addresses, and you want to display only the domain part (after the @ symbol). You can use the following formula in a label within the gallery:
Right(ThisItem.Email, Len(ThisItem.Email) - Find("@", ThisItem.Email))
This formula finds the position of the @ symbol and extracts everything after it.