Logic Expressions

Using Expressions in logic

You can set the visibility of layers and elements in the logic editor using expressions in the following way. First, add a Set Element or Set Question node to the logic panel and select Expression from the element dropdown.

The following expression types can then be entered in the element id input to control visibility. Note that both layers an elements are targeted when using expressions

1. Exact Match

Enter the exact name of an item:

  • If MainImage is entered, then any item with that name will be affected.

2. Wildcards

Use wildcards to target groups of items:

  • If * is entered, then all items will be affected
  • If Layer_* is entered, then all items whose name begins with Layer_ will be affected
  • If *_Black is entered, then all items whose name ends with _Black will be affected
  • Only 1 wildcard is allowed in an expression. For example, *Layer* is not permitted

3. Question Answers

Use the answers to questions to target specific items:

Question answers are referenced using the notation #[question_id] When concatenating strings and question answers, double quotes are required for the string portions Let’s assume there is a dropdown question with the id Q_Layout and the possible answers 1 & 2

  • If “Layer “ + #[Q_Layout] is entered and the current answer to Q_Layout is 1,then items named Layer_1 will be affected
  • If “Layer “ + #[Q_Layout] is entered and the current answer to Q_Layout is 2,then items named Layer_2 will be affected

Multiple question answers can be combined in the same expression

  • If “Image “ + #[Q_Layout] + “_” + #[Q_Color] is entered and the current answer to Q_Layout is 1 and the current answer to Q_Color is Black, then items named Image_1_Black will be affected

4. Combinations

Use combinations of wildcards and question answers to target specific groups of items:

  • If ”*_” + #[Q_Layout] is entered and the current answer to Q_Layout is 1,then all items whose name ends with _1 will be affected