Expression builder
- Updated: 2024/10/04
Expression builder
Use the Expression builder to build simple or complex expressions in a simplified manner.
When you create an automation, in the Action properties panel, for some actions that allow access of variables, you can either enter a value or click Insert a value in the property field to build the type of expression you want to create.
Benefits
- The easy-to-use expression builder wizard helps you build complex expressions more quickly and accurately, saving valuable time.
- The process of creating expressions becomes more intuitive and self-explanatory. You can easily set or edit the value of a variable with the built-in reference list of corresponding methods to choose from.
- You can preview the expression, and if the expression you have built is invalid, you will see an error icon displayed in the preview. This helps you to validate and check your expression's syntax to ensure it will run without error.
Capabilities
- Provides deeper property support (By name, index or Method): When you use a variable
such as a list, dictionary, or record, you can access the value either by
name or specific index number, or by using applicable methods (e.g., listGet
method for lists, DictionaryToString method for dictionaries) to determine
the index dynamically.
- Name: A key used as a unique identifier associated with a value.
- Index: An index refers to data that points to a specific location in the table, record, list, and so on.
- Method: Methods are functions that are called on objects. They play a crucial role in modifying or accessing the object's properties.
Example: $Inventory_Stock_2025[4]{"\"Manufacturing date\""}$
- Support to add expressions with arguments: When you select a method based on the
variable type, you can input parameters/arguments for the method. An
argument is the actual value that is passed to the method when it is called.
Example, Variable = $Employee_Data_2025$
Method: String uppercase-Uppercase (Convert the string at 0 index to uppercase).
New expression: $Employee_Data_2025[0].String:uppercase$
In this case, String:uppercase is a method of the string object name that returns the uppercase version of the string.
- Ability to build nested expressions: You can build an expression for name, index or
method that contains other expressions within it. Creating nested
expressions makes complex expressions easier to read, edit, and
debug.
Example: $listOfDates[0].Datetime.get[0].Number:toString$
- Resuming from highlighted expression: By selecting the entire expression from the
property text box and clicking on (x), you open the expression builder.
Here, the entire expression is segregated as per variable, Method, and
argument, giving you full control to further build an expression or update
the existing values according to your needs.
Example: You select expression $Dictionary_Var(name)$ and click (x), in the expression builder window. It shows you the expression you selected. Select Method and choose String trim-Trim to trim the spaces of the string. The new expression you build will be $Dictionary_Var{name}.String:trim$.
Building expressions
Option | Description |
---|---|
Enter the expression manually | When you create an automation in the Bot editor, you can manually
enter an expression in the action properties field, which allows
variables as input. When you enter a variable, the system suggests a list of system and user-defined variables. This list is filtered based on the text you type, guiding you in your automation creation. After entering or selecting a variable, you can choose the corresponding methods upon entering dot (.) after the variable name. This feature allows you to enter a combination of static text and variables, enhancing the flexibility of your automation creation. When you enter an expression, and if the expression is not valid, the error is highlighted with the relevant error message, that helps you to quickly identify and correct any mistakes. |
Using expression builder |
Alternative to the above method, as a developer, you can create an expression using
the expression builder. Press F2 or click the (x) icon to insert
a value in the property text box. When you open the expression builder, it presents you with a range of components to choose from, including variables (both system and user-defined) and global values. This flexibility empowers you to create expressions that suit your specific needs. Upon selecting a variable, the system provides you with a list of corresponding methods and arguments. This guidance ensures that you can make informed choices when building your expression, enhancing the quality of your work. After you select the variables and methods, you can preview the expression that you have built, and an error icon is displayed if the expression is not valid. Additionally, you can select variables and methods iteratively to build an expression. This capability gives you full control over the construction of your expression, allowing you to refine it until it meets your specific requirements. |