DET fields can be hidden using the ‘Display Conditionally Based On:’ field option
However, this option can only use Boolean fields, or ‘True/False’ fields, as its condition to show or hide.
As such the best way to make DET fields show or hide depending on a different field type (such as a number or text field) is to use a ‘helper field’, which uses a formula to calculate whether the condition is true or false.
The fields we need are:
- The Condition field – the field we will check to match the condition
- The Helper field – the field we will use to calculate if the condition is true or false
- The Result field – the field we want to show or hide based on the condition
Creating the Helper field
- Create a new Boolean field to use as the ‘Helper Field’
- Add the helper field to your DET
In the field settings, click ‘Enable Auto-Generate Formula’
- Save and reload the field settings page.
- Tick the ‘Auto Calculate on Save’ and ‘Auto Calculate on Mobile Sync options
- Press ‘Manage Auto-Generate formula’ and enter the conditional formula using the formula tools provided.
First insert the ‘If Statement’ to the formula head
- In the first two values, enter the name of the Condition field, and the value to match
In the ‘THEN’ statement, enter the number 1
The number 1 designates ‘True’, which means the value matches
In the ‘ELSE’ statement, enter the number 0
The number 0 designates ‘False’, which mean the value does not match
- The formula will look something like this:
- Save and close the formula editor. Save the changes to the field
Setting up the Result field
- Open the field settings of the Result field
- Scroll to the bottom of the settings window and click ‘Show Advanced Options’
Locate the ‘Displays Conditionally Based On’ setting, and select the helper field from the dropdown list
- Save the field settings.
To test and use the configured field:
- Open a job card
- Navigate to the condition field and enter a matching value into field.
- Click Save and reload the page
- Locate the helper field and the result field.
- Check that the helper field displays the correct value (checked if True, unchecked if false)
- Check that the Value field is not hidden.