Customizing Mathematical Expressions

The Expression Builder allows you to create complex mathematical expressions for existing functions, either variables or constants, defined within the rules.
To create a mathematical expression:
  1. Create a rule.
  2. To add a variable to the defined rule, right click on Document and select Set Variable.
    You are prompted with the Set Variable dialog.
  3. Fill out the required Name field and select the variable Type. From Value, make sure to select Expression from the drop-down menu list.
      Note:
    • The Expression option is available when you select INT, DOUBLE, or STRING from the Type field.
    The Set Variable dialog expends into an Advanced Builder dialog that allows you to create customized expressions.

    Expression Builder Box
    Indicates a user-defined complex expression.
    Summary
    Indicates an expression summary.

  4. To build an expression, click on Select Operand and select one the options from the drop-down menu list:
    • Functions - list of available functions;
    • Variables - list of already created variables;
    • Constants - known values;
    • Expressions- operands and operators, grouped together to indicate a certain value:
      2 operands
      Indicates an expression that consists of 2 operands and 1 operator.
      3 operands
      Indicates an expression that consists of 3 operands and 2 operators.
      Custom Operands
      Indicates an expression that consists of customized operands and operators.
      Inline
      Enter an expression of your choice.

      You can use one of these functions when you create an expression:

      • replaceFirstRegex(<Param1>, <Param2>, <Param3>): Replace first regex.
      • replaceRegex(<Param1>, <Param2>, <Param3>): Replace regex.
      • stringTrim(<Param1>): String Trim.
      • substr(<Param1>, <Param2>, <Param3>): Substract String.
      • stringLength(<Param1>): String Length.
      • range(<Param1>, <Param2>, <Param3>): Value in range.
      • concat(<Param1>, <Param2>): Concatenate Strings.

      These usage scenarios show possibilities of using the Inline option.

      • The expression uses numeric values: $x+$y or$x+1.0.
      • The expression uses string values: concat($a, "ABC") or concat($a, "1").

      You can use these operators in an expression: "+", "-", "/", "*", "%", "idiv". Also, you can use these brackets in your expressions: "(", ")".

      Note: Use the "idiv" operator for integer division.

  5. Review the Summary section.
      Note:
    • The Summary section is available only for expressions.
  6. Click ADD.
    The variable is added as a Set Variable rule under the RULES section.
To check the properties of the value, go to PROPERTIES, on the right side of the screen.