Calculation Rules

   MaestroPreviously known as Transact Maestro.  |   Form Builder |  5.1 & Higher This feature is related to 5.1 and higher.

Maestro allows you to create various calculations rules, which you can add to components and fields of a Maestro form. The calculation rules are part of the business rules and currently consist of the Script rule.

Maestro adds calculation rules to a form in the following order when:

  • Transaction XML data is loaded to a field on the form, so the rules will run before the Form Load rule is executedw
  • A field is made visible
  • A value of another field, that this rule depends on, changes

It is important to understand the order of rules execution to prevent empty values used in calculation rules so they don't break the rule logic or cause an exception.

You can use the Script rule in several distinct ways:

Mathematical Calculation

Mathematical Calculations allow you to create simple and complex mathematical calculations (+, -, *, etc.). Calculations can be created using data entered in components on the form, or by using defined numerical values. Mathematical calculation rules can be created in repeating blocks.

Duplicate Data

Duplicate Data from Another Component allows you to populate components in the form using data entered in another components.

Preset Data

You can preset some field's values as defaults on form load using a calculation rule. For example, you can select a default checkbox option when the form loads by setting its value to true, if the value is blank, using the following JavaScript:

if (Util.isBlank(data.checkBox)) {
    data.checkBox = true
}

It's important to note that we check whether the value is blank or not before setting its value, because if you open the form again after saving it when you have unselected the checkbox, the rule will set the default value again, as well as that of on a receipt.

Note

You can also set the value to true by using the Form Load rule, the Integration pane, or in the initial XML file, which Manager uses to prefill a form. The later is the easiest and most reliable option.

Concatenate Multiple Components

Concatenate Multiple Components allows you to take data entered into multiple components and combined the entered data into one component. An example of this is asking for a First Name and Last Name and combining them into a single Full Name component.

Next, learn how to create a mathematical calculation rule.