The Formula Action is a powerful tool that can be used to parse and control data within a project and offers a great variety of options to work with data. In this article we will review formulas of type Text, that can help you to build more advanced projects. To find additional information, read these articles that show how to use most commonly used formulas in Foxtrot.
- How-To Use LeftOf & RightOf Formulas
- How-To Use Remove & Replace Formulas
- How-To Work With A-PDF Text Extractor
Between formula returns the text found between two values.
- Original Text: The original text to be searched – required
- Start Value: The value marking the beginning of (but not included in) the text to keep – required
- End Value: The value marking the end of (but not included in) the text to keep – required
- Start Position: The character number (from the left) for the search of the Start Value (default is 1) – optional
- Left to Right: If True (default), the text will be searched from Left to Right for the End Value - optional
You need to extract the month number from the date 21/12/2018. The formula will look like this:
The result (12) is saved to a variable.
Trim, LTrim, RTrim
The Trim formula returns a copy of a text without the leading and trailing spaces. The LTrim formula returns a copy of a text without the leading spaces and RTrim – without trailing spaces.
Actions like Send Value or Get Value have this option included.
- String: Any valid string expression – required
The typical case of using this formula is when extracting a value from a web application. In many cases, the value will contain leading or trailing spaces.
The formula has only one parameter, and it looks like this:
Join formula joins items together with one string
- String 1,2,3,4,5: The string to join – 1-2 are required, 3-5 are optional
You have two variables that contain first name and last name of a person, and you need to join them to get the full name.
The formula looks like this. Please note that String 2 contains space.
In Foxtrot, you can build formula inside of another formula in a very easy way. Just press the Hold button.
Then when you are building another formula press the On hold button and choose the formula you want to put inside your current formula.
The final formula will look like this:
Please sign in to leave a comment.