labvanced logoLabVanced
  • Research
    • Publications
    • Researcher Interviews
    • Use Cases
      • Developmental Psychology
      • Linguistics
      • Clinical & Digital Health
      • Educational Psychology
      • Cognitive & Neuro
      • Social & Personality
      • Arts Research
      • Sports & Movement
      • Marketing & Consumer Behavior
      • Economics
      • HCI / UX
      • Commercial / Industry Use
    • Labvanced Blog
    • Services
  • Technology
    • Feature Overview
    • Code-Free Study Building
    • Eye Tracking
    • Mouse Tracking
    • Generative AI Integration
    • Multi User Studies
    • More ...
      • Reaction Time/Precise Timing
      • Text Transcription
      • Heart Rate Detection (rPPG)
      • Emotion Detection
      • Questionnaires/Surveys
      • Experimental Control
      • Data Privacy & Security
      • Desktop App
      • Mobile App
  • Learn
    • Guide
    • Videos
    • Walkthroughs
    • FAQ
    • Release Notes
    • Documents
    • Classroom
  • Experiments
    • Cognitive Tests
    • Sample Studies
    • Public Experiment Library
  • Pricing
    • Licenses
    • Top-Up Recordings
    • Subject Recruitment
    • Study Building
    • Dedicated Support
    • Checkout
  • About
    • About Us
    • Contact
    • Downloads
    • Careers
    • Impressum
    • Disclaimer
    • Privacy & Security
    • Terms & Conditions
    • Third-Party Licenses
  • Appgo to app icon
  • Logingo to app icon
Learn
Guide
Videos
Walkthroughs
FAQ
Newsletter Archive
Documents
Classroom
  • 中國人
  • Deutsch
  • Français
  • Español
  • English
  • 日本語
Guide
Videos
Walkthroughs
FAQ
Newsletter Archive
Documents
Classroom
  • 中國人
  • Deutsch
  • Français
  • Español
  • English
  • 日本語
  • Guide
    • GETTING STARTED

      • Task Editor
      • Frames
        • Canvas Frame
        • Page Frame
        • Website Frame
      • Trial Timeline
      • Stimulus Presentation
      • Correctness of Response
      • Objects
      • Events
      • Variables
      • Task Wizard
      • Trial System
      • Experiment Design
        • Creating a Study
        • Data Frame Patterns
        • Multi-user Experiment Design
        • Longitudinal Experiment Design
    • FEATURED TOPICS

      • Randomization & Balance
      • Eye Tracking
        • Presenting Stimuli in an Eye Tracking Task
        • How to Choose Eye Tracking Calibration Settings
        • Setting Up Eye Tracking in a Task
        • Recording and Exporting Gaze Data
        • Using Shapes as Areas of Interest (AOI) for Eye Tracking
        • The Participant Calibration Experience
      • Web Bridge
        • Selecting Website AOIs | Anchor, Adjust, and Verify AOI Tracking
        • Tracking Mouse Behavior on a Website AOI | Web Bridge Guide
      • Questionnaires
      • Desktop App
      • Sample Studies
      • Participant Recruitment
      • API Access
        • REST API
        • Webhook API
        • WebSocket API
      • Other Topics

        • Precise Stimulus Timings
        • Multi User Studies
        • Head Tracking in Labvanced | Guide
    • MAIN APP TABS

      • Overview: Main Tabs
      • Dashboard
      • My Studies
      • Shared Studies
      • My Files
      • Experiment Library
      • My Account
      • License & Services
    • STUDY TABS

      • Overview: Study-Specific Tabs
      • Study Design
        • Tasks
        • Blocks
        • Sessions
        • Groups
      • Task Editor
        • Task Controls
        • The Trial System
        • Frame Types
        • Objects
        • Object Property Tables
        • Variables
        • System Variables Table
        • The Event System
        • Text Editor Functions
        • Eye Tracking Options in the Task Editor
        • Head Tracking in a Task
        • Multi-User Studies
      • Settings
      • Variables
      • Media
      • Texts & Translate
      • Launch & Participate
      • Subject Management
      • Dataview and Export
        • Dataview and Variable & Task Selection (OLD Version)
        • Accessing Recordings (OLD Version)
  • Videos
    • Video Overview
    • Getting Started in Labvanced
    • Creating Tasks
    • Element Videos
    • Events & Variables
    • Advanced Topics
  • Walkthroughs
    • Introduction
    • Stroop Task
    • Lexical Decision Task
    • Posner Gaze Cueing Task
    • Change Blindness Flicker Paradigm
    • Eye-tracking Sample Study
    • Infant Eye-tracking Study
    • Attentional Capture Study with Mouse Tracking
    • Rapid Serial Visual Presentation
    • ChatGPT Study
    • Eye Tracking Demo: SVGs as AOIs
    • Multi-User Demo: Show Subjects' Cursors
    • Gamepad / Joystick Controller- Basic Set Up
    • Desktop App Study with EEG Integration
    • Between-subjects Group Balancing and Variable Setup
    • Building a Multi-user Study
    • Website Frame Eye Tracking Walkthrough
    • Conditional Webcam Eye Tracking
    • Text Segmentation Study Building
  • FAQ
    • Features
    • Support Policy & Guidelines
    • Security & Data Privacy
    • Licensing
    • Precision of Labvanced
    • Programmatic Use & API
    • Using Labvanced Offline
    • Troubleshooting
    • Study Creation Questions
  • Newsletter Archive
  • Documents
  • Classroom
Requirement Action branching If/Then/Else-If flowchart in Labvanced

Requirement Action (If... Then... Else If)

The Requirement Action is Labvanced's conditional logic block: it evaluates an if-then statement and executes a series of actions only when that statement is true. It is the mechanism behind any behavior that should differ depending on a variable's value, a participant's role, their previous response, or any other condition your study needs to check.

How it works

A Requirement Action is added like any other action: click Add Action, then Control Actions → Requirement Actions (If...Then).

Add Action menu in Labvanced showing Control Actions expanded to Requirement Actions (If...Then)
Adding a Requirement Action from the event editor's Add Action menu, under Control Actions.

A Requirement Action is built from a few parts:

  • Add Requirement: adds a comparison to the statement. A value-select menu appears on both sides, letting you compare a variable, a constant, or another value, with a comparison operator between them (equal, smaller than, unequal, and so on).
  • Add AND Group: all requirements within an AND group must be true for the whole group to be true. Use this when several conditions must all be met at once.
  • Add OR Group: only one requirement within an OR group needs to be true for the whole group to be true. Use this when the same action should run for several different cases.
  • Action Sequence: the list of actions under Then, executed only when the If statement's requirements are satisfied. Add a new action via the Add Action icon.
  • Add Else-If Case: a Requirement Action can hold several If/Else-If statements in sequence. Only one is ever executed, the first one whose requirements evaluate true; the rest, including any later Else-If cases, are skipped once a match is found.
  • Add Else Case: a fallback. If none of the If/Else-If statements evaluate true, the actions defined in the Else case run instead.

A worked example: branching by Role_Id

The most common use of a Requirement Action in a multi-user study is branching behavior by participant. A minimal example:

  • Add Requirement: left side selects the variable Role_Id; comparison is set to equal; right side is a constant number, 1.
  • Then: the actions that apply to that participant, for example a Set Object Property action showing a target image.
  • Add Else Case: the actions that apply to every other participant.

See Role_Id for the full explanation of what Role_Id is and why this pattern is the basis of every asymmetric multi-user design.

A worked example: scoring correctness in a Flanker-style task

Nested AND/OR groups make it possible to score a response as correct under more than one valid combination at once. A real example from the Flanker Task's Main_task_desktop_Flanker, on Frame 3 (Response Window), inside the Response Recording & Progression event (triggered by a keypress):

  • If, within an OR group: (target_direction_desktop equals left AND choice equals D), OR (target_direction_desktop equals right AND choice equals K).
  • Then: Set / Record Variable sets accuracy to 1.

Either combination, left target with a D press or right target with a K press, counts as correct, so the two AND groups are combined under a shared OR group rather than written as separate Requirement Actions.

Nested Requirement Action checking target direction and key choice to set an accuracy variable in the Flanker Task
A Requirement Action from the Flanker Task's Response Window frame, scoring accuracy from two valid target/response combinations.

Further Reading

Illustration of the event system in Labvanced, the full reference for every trigger and action

Event System

The full reference for every trigger and action in Labvanced, including Requirement Action's complete parameter list.

Role_Id

The system variable most commonly checked inside a Requirement Action in multi-user studies.

Building a Multi-user Study

A step-by-step walkthrough using a Requirement Action to assign different content per participant.