Item Property - Active Item & Hidden Expressions
Active Item & Hidden Expressions are similar to Calculations, but the result of the calculation must be true or false.
The following behaviour is produced in each expression:
- Active Item Expression - if the result is true, the item will be active in the form and submits data. If the result is false, the item will not be active and will not submit data.
- Hidden Expression - if the result is true, the item will be hidden in the form, but still remains active and submits data. If the result is false, the item will be visible in the form, remains active and submits data.
Active Item Expression
Let's look at an example for Active Item Expression. I have an element I only want visible when I am fitting screw caps to my bottles. I will use an attribute called Closure type, which is a text string attribute. I write my expression as such
Note that, as a string, the value must be in quotation marks. In the first order, this Closure type's value is "Screw Cap" so the calculation is true, and the item is active:
However, in the second, order, this Closure type's value is "Cork" so the calculation is false, and the item is inactive:
We apply the same approach to Hidden Expressions. The only difference is that Hidden Expressions do not change if the item is active; only whether it is visible.
In the following example, we want to hide an element that does not need the operator's response, but we do still want the data recorded.
This calculation results in a sentence constructed of hard-coded text, the value of another element in the activity ( Bottle Colour) and 2 attributes (Closure type and Machine model). If visible, the operator would see this result:
This element isn't relevant to the operator, but the data does need to be captured. To make sure this element is hidden at all times, we add the following calculation to the Hidden Expression:
Here, we are using the element's own Item Key to say; if the value of this is null OR is not null, then make this element hidden.
This is likely to be your most common calculation for Hidden Expression as it will guarantee that the item is always hidden.
In this screenshot, you can see that item is hidden, but in the following screenshot, you can see that the data from it was still submitted
Back to: Activity Templates - Details