Start a conversation

Can I make a field dependent on multiple fields?

When creating or editing a field, it is possible to make it dependent on only one field. However, using hidden calculation fields, you can also create dependencies on multiple fields. 

For example, I want my Field_4 to be dependent on both Field_1 and Field_2 being answered with "Yes". In this case, my fields 1 and 2 are radiobutton fields, with options "Yes" (option value 1) and "No" (option value 0). I create a calculation field (Field_3) between Field_2 and Field_4 and I will select the option to hide it (because I don't want it to be visible in my records); it will only be executed in the background. This is the calculation template:

if ({Field_1} == 1 && {Field_2} == 1) {
  1;
} else {
  0;
};

This means that if fields 1 and 2 are answered with yes (=1), this calculation will return a 1, if not it will return a 0.

You can add as many fields as you want in your if clause and you can also change the && (meaning AND; dependency on both values) to || (meaning OR; dependency on either value).

You can also check for multiple values of the same variable. For example, if you want to make Field_4 to be dependent on Field_1 being answered with "Yes" or "Maybe", then I will create the same calculation field as above, only using a slightly different template:

if ({Field_1} == 1 || {Field_1} == 2) {
  1;
} else {
  0;
};

Then, I will make my Field_4 dependent on this calculation field, Field_3, being equal to 1.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Castor Support Team

  2. Posted
  3. Updated