Execute the calculation if not all variables have been filled in
The logic of this calculation can be used to prevent the text “Not all values for this calculation are available (yet)” that is shown until all the relevant variables have been filled in. This is an example using the calculation of the age based on two date fields.
It is important to note :
- this method is useful if the variables involved are mandatory
- if zero (0) is an expected value in one of the fields, the arguments in the if-clause need to be modified
- the calculation will work for all types of variables except for grid fields and checkboxes
The rationale is to replace the empty fields with a zero (0). Then, use an if-else statement to check first if all our variables contain values that are different to 0. If they do, the desired calculation will execute (for example, the difference between two dates). While one of the dates has not been filled in (i.e. there are zeros), no message will be displayed in the calculation
TIP: enter the calculation in Castor to see it working live in your own study.