Start a conversation

Adding a dependency on a grid field

Calculation fields can be used to make other fields dependent on certain values added to the grid field.

For example, this template outputs 1 if the data entered into the Row one, Column 1 is 'Yes' (equals to 1):

var obj = JSON.parse('{grid_variable_name}');

if (Object.values(obj[0])[0] == 1) {
} else {

This calculation will be hidden, as we do not need to display the output in the data entry view and only to use it to make the next field (8.2.1) dependent.

Use if/else logic to render the output based on the answer in the Row onw, Column 1. 

If the answer in the Row one, Column 1 changes to 'No', the calculation is triggered and the dependent field is no longer shown:

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

  2. Posted