Expression Builder allows you to build numeric and text-based expressions. You can access this from the Statement menu in action logic editor.
expression statement type
Expressions are helpful in building concatenated strings or for performing numeric calculations for verification in test logic.
- Text-based/ String expressions allow any arbitrary string or parameters to be combined together.
- Numeric expressions allow mathematical calculations involving either hard-coded numbers or parameters. You can also specify the decimal precision to be used in the result of the calculation. Following operations are supported:
Plus (+), minus (-), multiplication (*), division (/), parenthesis (())
Parameters are denoted with angle brackets(<>) around the name of the parameter.
Window- Expression Builder
The value of an expression is always assigned to a local or action output parameter. Once you save and close the expression, you specify the assignment parameter, just like you do in the regular statement creation process.
Example - Concatenating parameters
Following example shows how to construct server URL with the server name and port number concatenated. Both DB Server and DB Port are action input parameters. Result of the expression is assigned to a local parameter, Server URL.
The expression is concatenating "https://" + <DB Server> + ":" + <DB Port>
Note that you do not have to include double quotes around literals or the "+" sign for concatenation. Anything other than a parameter is considered a literal by default and all the components are concatenated together without any operator used.
Example - Calculating interest rate
Following example shows how to calculate sales tax on a purchase amount. Item Price is an action parameter and the result of the expression is assigned to a local parameter sales tax.
sales tax = 0.0825 * <item price> (8.25 % of item price, rounded to 2 decimal places)
Note: In case you need to insert a "<" or ">" character as a literal in the expression, prefix with "\".