Add a Calculation Rule action

Use a Calculation Rule to dynamically control how the content of a form field, form variable, or global variable is calculated and displayed on a form.

At runtime, the calculation rule is invoked once the user clicks the control where the action is defined.

Example

A BPM site used by a shipping firm automatically generates and emails invoices to customers. Using a Calculation Rule, the VAT can be calculated and added to the Subtotal at a rate of 17%.

  • If Total = VAT + Subtotal

  • Where VAT = 17% of Subtotal

  • Then Total = ((17/100)*Subtotal) + Subtotal

  • If Subtotal = 200

  • Then Total = ((17/100)*200) + 200

  • Total = 234

If Total appears in text box 1, and Subtotal in text box 2, this is the calculation rule:

  • Text box 1 = ((17/100)*text box 2) + text box 2

  • The text box 1 is mapped to output.

When creating a calculation rule, provide a static value or select values from form fields, form variables, or global variables.

If the output type of the calculation is Numeric, and the form contains a Numeric type control such as a radio button or text box, you can use the value of the selected radio button or text box in the calculation.

Similarly, if the output type of the calculation is String, and the form contains a String type control such as drop-down, label, radio button, or text box, you can use the values of the selected controls in the calculation.

You can only configure text box and calendar controls as calculated fields, and only use String, Numeric and Date data types.

When a Calendar control is selected as a calculated field, you can only specify Date text boxes and calendars for the first value and numeric for the second values. For example, to send a reminder to a customer for paying the policy premium, you can create a Calculation Rule action that sends the reminder to the customer certain days before the due date. Then the calculation rule might be: Calendar1=DueDate - Days (Where DueDate is the last date for paying the premium). In this instance, the DueDate is the Date text box and Days is the numeric text box.

  1. On the Form Modeling bar, click Actions.
  2. On the Actions page, click Add Generic Add.
  3. On the Type list, select Calculation Rule.
  4. Enter a Name and Description for the action.
  5. Optionally, configure a unique action for each language separately. See Configure multilingual actions for a form or control for more information.
  6. To store the output of the rule, consume the required form field, form variable or global variable in the Output box.
  7. In the Rule box, define the rule or consume the rule. See the preceding example.
    Note You can reuse the rule by copying and pasting it in another calculation rule.
  8. Click OK.

    The newly created action is added to the table.

  9. Click Save.
  10. Associate the action with the control to trigger this action. To call the Calculation Rule upon form load, associate the action with the form. See Associate an action with a form or control.

    When this action is triggered, the fields are calculated and appear as configured.