Currently you are not logged in. Before you can download and upload forms and calculations, please .

Execute the calculation if not all variables have been filled in

Castor EDC Team
10 Nov, 2020

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.

Fields used in calculation
Date of birth
Current date
Currently you are not logged in. To see and try this calculation, please .