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, the following is the calculation rule:
-
Text box 1 = ((17/100)*text box 2) + text box 2
-
The text box 1 is mapped to an output.
When creating a calculation rule, provide a static value or select values from form controls, 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 dropdown, 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 value. 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.
-
On the form modeling bar, click
Actions and click
New.
The New action dialog box is displayed.
- On the Type list, select Calculation rule.
- Change the default Name (CalculationRule1) to something meaningful.
- Optional. Enter a Description for the action.
- Optional. Select Multilingual to configure a unique action for each language separately. See Configure multilingual actions.
- To store the output of the rule, select the required form control, form variable, or global variable on the Output list.
-
Right-click on the rule editor and create a
Rule using form controls, form variables, or global variables.
You can reuse the calculation rule by copying and pasting it in another calculation rule.
-
To validate the rule, click
Validate.
The system indicates whether the rule is valid.
-
Click
Add.
The newly created action is added to the table.
-
Associate the action with the control to trigger this action. See
Configure actions for form control
events. Alternatively, to call this action for a form event, associate the action with the form. See
Associate an action with a form.
When this action is triggered, the fields are calculated and appear as configured.
See also: