Calculate Sum rule

This rule is used to calculate the sum of several field values and enter it in a specified field. For example, if the document has fields that contain a salary, bonus, and other similar amounts, you can set up a rule to calculate their sum and writing the result in a certain field.

This rule can also be used for calculating the sum of values in a table column. To achieve this, this kind of rule must be created in the Document Definition Properties or in the section properties. Be sure to clear the At least two non-empty objects required option.

To create a sum calculation rule, do the following:

  1. Open the Field Properties dialog box (right-click the field to open its shortcut menu and select Properties...) or the Document Definition Properties dialog box (from the Document Definition editor menu, select Document Definition → Document Definition Properties...).
  2. Go to the Rules tab.
  3. Click New Rule...
  4. In the list of rules, select Calculate Sum and click OK.
  5. Type the name of the rule.
  6. Disable the Show rule name in message to verifier option if necessary. If this option is disabled, the error message will be displayed as "error message" instead of "name of rule: error message".
  7. If required, specify the conditions under which the rule must be applied (by default, a rule is applied unconditionally). See Conditions for applying rules for more information.
  8. Specify tags for the rule.
  9. Disable the Enabled rule option if necessary. The rule will be created, but will not be applied until this option is enabled by a user.
  10. Click Next >.
  11. In the dialog box that opens, add fields with values to be added to the Summarize values of fields list. To do it, click the Add....
  12. In the Result field field, specify the field you need to enter the sum in. To do it, click Select....
  13. Select At least two non-empty objects required if you need at least two non-empty and non-zero summands to be used. Unless this condition is fulfilled, an error will be output in the rule errors window during the check of the rule.
    Note: When applying this option in rule parameters, it is necessary to add at least two document fields (or two table columns) to the addition. So if you use this rule to add values from all cells of a table column, you need not select this option.
  14. Click Finish to finish creating the rule. The rule name will be displayed on the Rules tab.

11/10/2020 12:08:04 PM

Please leave your feedback about this article