Defining rules that use mathematical formulas

You can create simple mathematical formulas in business rules to calculate field values (such as Total Cost). Only Integer, Real Number and Simple Text fields can be used for calculation results.

Formulas follow the standard order of operations. The supported operators are * (multiply), / (divide), + (add), and - (subtract). You can use parentheses to group operations. When the rule runs, the system validates the formula and displays an error message if it finds unmatched parentheses, parentheses in incorrect order (that is, a closing parenthesis prior to the opening parenthesis), parentheses with no data within them, and so on. You can save a rule with an invalid formula so make sure to test these rules in a working environment to validate them.

You can use variables for any field (of any type) in a formula. In production, the system will try to convert values for the variables to numbers. If some value cannot be converted, then the system generates an error.

Formulas and dependent field groups

Because fields used in dependent field groups contain text, mathematical formulas may not work with them. For more information about dependent field groups, see Creating dependent field groups.

The following topics are provided:


In this example, we want to add the values in two fields and place that value in a third field. That formula would look as follows: ([Field1]+[Field2]). The result would be placed in the Result field that you select.

Another example might be to calculate tax on a sold item. That formula might look at follows: (Cost*.07).

An example of a complex formula is attached to this topic.


To create a mathematical, formula, you must first create the integer and/or real number fields to be used in the formula, including a "result" field for the result of the formula. Once you have created the fields, you can create the mathematical formula.

To define a rule that includes a mathematical formula

  1. Open the container and item where you want to define the rule:
    1. Click the Administration tab.
    2. In the appropriate section, click the name of the container or click Manage to open the container Administration page. Then, double-click the container.
      The container details page appears. 
    3. In the left pane, click the item link (such as Record Definitions in workspaces).
      The Items page appears. 
    4. Double-click the item that you want to modify.
      The Item details page appears.
  2. In the left pane, click Business Rules.
    Icons for the rules associated with this item appear in the right pane.
  3. Click New Business Rule, and select the appropriate rule type.
    The Rule Builder page appears. For detailed information about configuring different types of rules, see Types of business rules.
  4. In the Business Rule Name field, enter a descriptive name for this rule.
  5. (Optional) In the Description field, type a useful description for this field.
  6. In the Business Rule Schedule field, accept the default of Run Any Time, or select from custom schedules defined for this container.
  7. In the Triggers section, select a trigger and configure the details.
  8. In the Criteria section, define the criteria for this rule, following the instructions in Configuring business rules.
  9. In the Actions section:
    1. Click Add new action.
    2. In the Action field, select Calculate field value.
    3. In the next field, select the field where the result should be placed (such as Total Cost).
    4. In the Value field, type the formula for calculating the value for the result field. To use field variables in your formula, place your cursor where the field should be placed in the formula, select the field in the Field Variables field, and click Insert.
      Variables appear in the format [field_xxx]  where field_xxx is the internal name for the field that you selected as a variable.
    5. Review the formula to verify it is correct.
    6. Click Create.
  10. When you have finished configuring the rule, click Save.
  11. Publish the container to implement your changes:

    1. In the breadcrumb trail, click the container link.

    2. Click Save and Publish.

      A confirmation message appears.

    3. Click Yes.

      The Publication Succeeded message appears, showing the number of errors and warnings.

  12. Make sure to verify that the rule performs as expected.

Related topics

Managing business rules

Deleting business rules

Was this page helpful? Yes No Submitting... Thank you