Operators, rules, and behavior for visibility expressions
- Last UpdatedDec 17, 2024
- 2 minute read
As you build an Object Wizard, you can create visibility expressions that selectively hide Choice Groups, Choices, and Options. This can simplify the workflow by only showing Choices and Options that are applicable, based on Choices and Options that the user has already made. When an Option or Choice Group is hidden, the system applies the configured default values for attributes, graphics, and scripts associated with the hidden Option or Choice Group. You can leverage this capability to hide advanced functions from users tasked with configuring instances from templates that contain Object Wizards.
The Visibility prompt lets you assemble expressions to hide or show Choice Groups, Choices, or Options based on what the user has previously selected. Note that Visibility cannot be conditional for the first Object Wizard item (Choice Group or Option). The first Object Wizard item is always visible. Available logical operators are AND, OR, and NOT.
Observe these basic rules and behaviors when building visibility expressions:
-
Always start by typing the " [ " (open bracket character) in the visibility text box. This will bring up a list of all Choices (from other Choice Groups) and Options that precede the selected item. Do not simply highlight an element without first typing the open bracket character.
-
Choices are listed with their Choice Group. Each Option is listed twice, for both states (True and False). Use fully qualified Option/Choice selections surrounded by brackets. The separator between Choice Groups and Choices, and between Options and their states is "::" For example:
[Valve Type::3-Way] OR [Valve Type::4-Way] AND [Option1::True]
-
Valid logical operators:
-
Valid binary operators are "AND" and "OR".
-
Valid unary operator is "NOT".
-
"AND" has a higher precedence than "OR".
-
"NOT" has a higher precedence than "AND" or "OR".
-
You can use "&" or "&&" instead of "AND".
-
You can use "|" or "||" instead of "OR".
-
You can use "!" instead of "NOT".
-
-
Parentheses can be used to build complex expressions. For example:
[ChoiceGroup1::Choice1] AND ([Option1::True] OR [Option2::True] OR [Option3::False])
Note that without parentheses, this expression would resolve very differently, since "AND" has a higher precedence than "OR". If parentheses were not used, the expression would resolve this way:
[ChoiceGroup1::Choice1] AND [Option1::True] OR [Option2::True] OR [Option3::False]
-
Literals and operators are not case sensitive.
-
Spacing between literals and operators is optional.
-
The visibility expression editor validates the logical expression as you enter it, but does not check if the expression is possible. For example, the expression "[Valve Type::3-Way] AND [Valve Type::4-Way]" would not be flagged since it is logically correct, even though the condition is impossible (you cannot select more than one Choice from a single Choice Group).