RIGHT
Use the RIGHT function to return the specified number of characters from the end of a text value.
Use
RIGHT( text [, num_chars] )
Returns the rightmost characters from a text value.
| Parameter | Required | Description |
|---|---|---|
| text | Yes | the text containing characters to return |
| num_chars | No | the number of characters to extract; if omitted, assumed to be 1 |
| Returns | Text |
Examples
Extracting a Sequence from a Project Code
You can use the RIGHT function in an Input Mapping formula or a Variable Update to isolate a specific numeric sequence from a standardized text ID.
- Scenario: Your "Project ID" follows a fixed format like "PRJ-2024-8842," and you want to extract just the last four digits to store in a variable called
$ProjectSequence. - Formula:
RIGHT(@Trigger.out.ProjectID, 4) - Logic:
@Trigger.out.ProjectID: This retrieves the full text string from the trigger form.4: This tells the function to count four characters back from the very end of the string.
- Result: The function returns "8842" as a text string.
Validating a Required Suffix
You can use the RIGHT function in an Output Validation formula to ensure that a user has followed a naming convention that requires a specific ending.
- Scenario: In a "Final Document Upload" step, you want to ensure the "Document Title" field ends with the suffix "-FINAL" before the user can submit the form.
- Formula:
ASSERT(RIGHT(this, 6) = "-FINAL", "The document title must end with '-FINAL'.") - Logic:
this: In validation, this refers to the current value of the field being checked.RIGHT(this, 6): This grabs the last six characters of the user's input.= "-FINAL": This compares the extracted text to your required suffix.
- Result: If the user enters "Project_Budget-FINAL", the function returns "-FINAL", the comparison is TRUE, and the validation passes. If they enter "Project_Budget", it returns "Budget", and the ASSERT function displays the error message.