ENDS
Use the ENDS function to check if text ends with specific characters and returns TRUE if it does.
Use
ENDS( text, end_text )
Checks to see the first text value ends with the second text value.
| Parameter | Required | Description |
|---|---|---|
| text | Yes | the text to test |
| end_text | Yes | the text to search for at the end of text |
| Returns | Logical |
Examples
Output Validation with specific feedback
You can use ENDS within an Output Validation Formula to ensure users follow a strict naming convention or file format requirement. By pairing it with the ASSERT function, you can provide a custom error message if the condition is not met.
- Scenario: A user must enter a "DocumentReference" that ends with the suffix "-FINAL".
- Formula:
ASSERT(ENDS(this, "-FINAL"), "The reference must end with '-FINAL' to be submitted.") - Logic:
this: Refers to the current value being entered in the field.ENDS(this, "-FINAL"): This checks if the last characters are "-FINAL".- Result: If the user enters "Project_Alpha", the condition is FALSE, and the form will display the error: "The reference must end with '-FINAL' to be submitted.".
Routing an Approval (Path Conditions)
The ENDS function can be used in a Conditional Branch step to determine which path an approval should follow based on data captured in a previous step.
- Scenario: An approval has two paths: "Finance Review" and "General Review." You want any request where the "BudgetCode" ends in "FIN" to go to the Finance team automatically.
- Formula (on the Finance path):
ENDS(@Trigger.out.BudgetCode, "FIN") - Logic:
@Trigger.out.BudgetCode: Pulls the value of the BudgetCode output from the trigger step.- Result: If the code is "DEPT-2024-FIN", the formula returns TRUE, and the approval follows the Finance path. If the code is "DEPT-2024-OPS", it returns FALSE, and the system looks for the next valid path.