Dependencies (field logic)

Transcript:

  • Castor supports field dependency or field logic
  • In other words, it is possible to show or hide a field based on the previously given answers.
  • For example, data on pregnancy which should only be collected for female patients.
  • To add a dependency for a field, open the Dependencies tab.
  • Dependent fields are only shown if the specified condition is met.
  • Here you can set the current field to depend on the response added to another field.
  • A Calculation field can be used to set up an advanced dependency, such as dependency on multiple fields or multiple responses to a single question.
  • A question will appear only when answers to several previous questions match certain criteria
  • In this study, when collecting data on the subject’s tobacco consumption, I would like to collect data on the number of packs consumed per year only for current or former smokers
  • First, I create a radio button field Tobacco consumption which can be answered with the following options: Non-smoker with the value of 1, Former smoker with the value of 2, and the Actual smoker with the value of 3.
  • I will also create a number field to collect the data on the number of packets consumed per year
  • Next, we create a calculation field after the Tobacco consumption field
  • Since this field is only used to create an advanced dependency, this field should be hidden
  • In this calculation field I am using if-else logic to check the conditions
  • If the field tobacco consumption is answered as former smoker with the value 2 or as actual smoker with the value of 3, the calculation will output a value of 1. If the consumption field is answered as a non-smoker, the output will be 2.
  • The calculation uses the logical OR operator (double vertical line) to check if one of two conditions are met.
  • Finally, click on the field which should be dependent and navigate to the Dependencies tab.
  • In the Dependency on field, choose the calculation field which you have just created
  • If the calculation field has a value of 1, the number of packets should be displayed
  • We can test this calculation by opening a record and entering responses into the fields.

Complete and Continue