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:
- 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...).
- Go to the Rules tab.
- Click New Rule...
- In the list of rules, select Calculate Sum and click OK.
- Type the name of the rule.
- 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".
- 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.
- Specify tags for the rule.
- 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.
- Click Next >.
- 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....
- In the Result field field, specify the field you need to enter the sum in. To do it, click Select....
- 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. - Click Finish to finish creating the rule. The rule name will be displayed on the Rules tab.
12.04.2024 18:16:02