Form rules allow you to specify a filter which is used to define under what conditions the Form will be hidden/not, and which teams it will be hidden from/shown to. They are configurable when on a Form in the 'Forms' section, under the 'Form Rules' Template, via the 'Add Form Rule' button.
The generic initial syntax for a form rule is $filter= however, from here how you structure the remainder of the expression will depend on the Field in question. Whether or not you want the expression to evaluate the Field as equal to (eq) or not equal to (ne) a certain value will also have an impact.
These can also be used in addition to the below 'eq' and 'ne' where applicable:
- gt for >
- gte for >=
- lt for <
- lte for <=
$filter=[BitFieldIdentifier] eq true: This will hide the Form in question if the referenced Bit Field is checked (true).
$filter=[BitFieldIdentifier] eq false: This will hide the Form in question if the referenced Bit Field is not checked (false).
$filter=[TextFieldIdentifier] eq 'Text': This will hide the Form in question if the referenced Text Field is equal to the quoted text.
$filter=[TextFieldIdentifier] ne 'Text': This will hide the Form in question if the referenced Text Field is not equal to the quoted text.
These types of Fields have two Fields created, a main Value Field and an _Text backing Field that holds the text for the option. For example I could have High and Low as the Text Fields (options) in a Select List but their values could be 5 and 0 respectively. Hence, you can either reference the _Text Field or the Value Field:
$filter=[SelectonFieldIdentifier_Text] eq 'Option Text'
$filter=[SelectonFieldIdentifier] eq 'Option Value'
Like with all Form Rules the equivalent ne (not equal to) version of these expressions can be used if desired also.
$filter=[NumberFieldIdentifier] eq The desired number
$filter=[NumberFieldIdentifier] ne The desired number
Example - If you wanted to hide a form when a Number field equalled 10:
$filter=[NumberFieldIdentifier] eq 10
Once you have constructed the Filter Rule, you need to select the Teams you want it to apply to - for a Template Rule, you will also have to specify the Template it is applied to and for a Field Rule also the Field. Finally don't forget to click 'Add Form Rule' followed by 'Update Form' to save any changes made.
Note: You won't be able to select a Target Field until a Target Template has been selected.
Note: You can have multiple Form Rules on the same Form.
Tip: You can use 'and' / 'or' to include further criteria in the same Filter String.
e.g. $filter=([Centre2Master] ne '' and [Centre3Master] eq '') or ([Centre2Master] eq '' and [Centre3Master] eq '')
This is saying to hide the Template in question: IF Centre2Master doesn't equal null (isn't blank) AND Centre3Mater equals null | OR IF Centre2Master equals null AND Centre3Mater equals null. If both conditions in either pair are met then the Template will be hidden.
Template Filter Rules are used to hide Templates when specified conditions are met. They are constructed in an identical manner to Form Rules and are added by choosing a Target Template. Therefore please refer above for the correct syntax.
Note: You can only have one Filter Rule per Template currently, so if you want to hide a Template under multiple different conditions you will need to use and / or as seen in the Tip above. - This won't be the case in future however.
Field Rules *Coming soon to Softools*
Field Filter Rules are used to hide Fields when specified conditions are met. They are constructed in an identical manner to Form Rules and are added by choosing a Target Template and Target Field. Therefore please refer above for the correct syntax.