Controlling the display order of paths within Group logic — inside or outside of a Smart Loop — can be done using a mix of array and scoring logic.
⚠️ Note: This approach is not recommended when a max limit is applied to the Group logic or Smart Loop.
How to Control Group Logic with a Custom Array
- Create a reference array holding the order in which assigned paths should be shown. Use values from 1 to the number of paths (e.g. for five paths, use 1–5). If this array is already being used in Sort by logic, you can reuse it — no duplicate needed.
- Create a variable to track the number of paths seen, starting at 1 — e.g.
[shownext=1]. Place this in a question seen by all respondents who will need their display order controlled, before they enter the Group logic or Smart Loop. - On the last question within each path (seen by everyone assigned to that path), increment the variable by 1 — e.g.
[shownext+1]. If the last question has conditional show/hide logic restricting who sees it, ensure the counter increment is applied elsewhere so all respondents have their counter updated before moving to the next path. - Add logic to each question within a path to check whether the array value for that path matches the position to be shown next. For paths with more than one question, apply this logic to all questions, or to any logic that only shows if a previous question in that path was answered. If additional show conditions exist, combine them with the display order check.
Example
For a setup with three paths (one question each), the initial array and variable would be:
[order << 1,2,3][order = shuffle order] [shownext=1]
On the first path's question, this logic checks whether the path is ready to be displayed based on the array order:
[Show if (order|1=1 and shownext=1) or (order|2=1 and shownext=2) or (order|3=1 and shownext=3)][shownext+1]
Here, order is the array name, |1 checks the value at position 1 in the array, =1 checks for the first path, and shownext= validates whether it's time to show that position. Since this is the only question in the path, [shownext+1] increments the counter immediately to look for the next path.
Logic for the second and third paths respectively:
[Show if (order|1=2 and shownext=1) or (order|2=2 and shownext=2) or (order|3=2 and shownext=3)][shownext+1] [Show if (order|1=3 and shownext=1) or (order|2=3 and shownext=2) or (order|3=3 and shownext=3)][shownext+1]
The only difference between each path's logic is the value being searched for in the array.
⚠️ Note: If multiple sets of this logic are used in the same study, create a new counter variable for each set, or reset the counter to its starting value (e.g.
[shownext=1]) between sets.