
Branching and Skip Logic in Labvanced
Branching sends participants down different paths depending on a condition, such as an answer or a score. Skip logic is branching that lets them bypass parts that don't apply, for example smoking questions for non-smokers.
To branch a study in Labvanced, add an event that checks a condition with the Requirement Action (If...Then), then use Jump To to send participants to the right place.
Which method to use
| You want to... | Use |
|---|---|
| Send participants to a different frame, task or block | Requirement Actions (If...Then) with Jump To |
| Run the same actions several times | Repeated Actions (Loop) |
To show or hide a follow-up question, see how to use the Set Object Property Action to show it based on an answer.
Set it up
First, store the answer or score you want to check in a variable.
Jump based on a condition
- Open the event that should make the decision, such as a response event.
- Click
Add Action, then chooseControl ActionsandRequirement Actions (If...Then). - Under
If:, clickRequirement. Use the pencil icons to pick what to compare and choose a comparison, such as==or<. To combine conditions in a Requirement Action, add more to theANDgroup (all must be true) or add anOR-Group(one must be true). - Under
Then:, clickAdd Action, chooseJump ActionsandJump To, and pick a destination. - Check
Add Else Caseand add the actions for everyone else. For more cases, clickAdd Else If Case.
Example 1: branching for participant consent. In the webcam opt-in walkthrough, a
Variable Value Changedtrigger checks the answer.
If: the answer isYes
Then:Jump Actions→Redirect To URL(webcam study)
Else If: the answer isNo
Then:Redirect To URL(non-webcam study)
Example 2: branching for a performance criterion. In the Card Sorting Task, this rule is on the
Feedbackframe.
If:counter_correct>=10
Then:Jump To→Next Task
Example 3: branching for adaptive testing. In the Digit Span Task, the
feedbackframe checks the forward span. Each jump has a 500 ms delay.
If:accomplished_span_length_forward>=minimum_span_threshold
Then:Jump To→Next Trial
Else:Jump To→Specific Task→Results-Forwards
Common destinations:
Next Frame,Next Trial,Next TaskorNext Block: move forward from the current position.Specific Frame: go to a frame you select.Specific TaskorSpecific Block: go to a task or block you select.
Repeat actions with a loop
- Click
Add Action, then chooseControl ActionsandRepeated Actions (Loop). - Choose
Execute complete loopto run without pauses, orExecute every ... msto run on a timer. - Check
Define the number of loops,Enable stop conditionor both. - Add the actions to repeat.
Example 4: looping for repeated sounds. In the Repeated Sound Demo, a
Frame Starttrigger starts the loop in theRepetition of sound and counterevent.
Loop:Execute every ... ms, set to1000
Each repetition: play the sound, then add 1 tocount
Stop Condition (While Not):count==5
A loop repeats actions, not frames or trials, and ends with the frame. To repeat a frame, use Jump To.
Good to know
- Only the first true case runs. Later
Else If:cases are skipped, so put the most specific condition first. - Give everyone a way forward. Without an Else case, nothing runs when all conditions are false, which can leave participants stuck.
- Keep
Jump Tolast. Place it after actions that record data. - Always limit a complete loop. Without a loop number or reachable stop condition,
Execute complete loopfreezes the study.
Before launch, test every path and check the recorded data for each. To block a jump until required questions are answered, check Check Required Answers Before.
Examples in published studies
Import the studies for Examples 2 and 3 from their task pages.
Card Sorting Task
Inspect the Feedback frame to see how a correct-answer counter moves participants to the next task.
Digit Span Task
Inspect the feedback frame to see how the span reached decides between another trial and the results task.