RE: Field that sums up four fields
Hi partner,
There are two solutions to this problem.
- No code - business rules and calculated fields.
- Code - Javascript.
I introduce the first way here.
Because as long as one of the four fields is empty, the field 'sum' will be empty. So we have to make the empty fields 0 first.
In order not to change the values of the four fields themselves, we need to create auxiliary fields for them.
- If the field is not empty, copy the value of the field to its auxiliary field.
- If the field is empty, set its auxiliary field to 0.
Finally, we use 4 auxiliary fields to set the calculation field.
The downside is that four auxiliary fields are displayed on the form and are seen by users.
Here are the detailed steps:
1) This is field 'A' and its auxiliary field 'A copy'. The other three fields are B, C, and D. Add them to the form.

2) Create four business rules, set as follows:
IF
A contains data
THEN
Set A copy to A
ELSE
Set A copy to 0

Create the same business rules for B, C, and D.
3) Create a calculated field 'sum' and set its logic to 'A copy + B copy + C copy + D copy'.

4) Finally, set the four auxiliary fields to read-only on the form.

The effect is as follows:
