Skip to main content

Display Logic Engine

Basic Principles

Using show and hide keywords indicates display logic.

The DSL engine follows these 3 principles when running:

  1. Questions are visible by default
  2. If a question uses show, it becomes hidden by default
  3. Executes in DSL order, changing question visibility when conditions are met

Let's look at specific examples:

Scenario 1

if Q1A1 then show Q2

Before Answering

StatementEngine UnderstandingQ2 Visibility
Initialize, Q2 uses show keyword, following principle 2Hidden
if Q1A1 then show Q2Q1A1 not answered, condition not met, ignore actionHidden

Final result: Q2 is hidden

After Selecting Q1A1

StatementEngine UnderstandingQ2 Visibility
Initialize, Q2 uses show keyword, following principle 2Hidden
if Q1A1 then show Q2Q1A1 answered, condition met, execute actionVisible

Final result: Q2 is visible

Scenario 2

if Q1A1 then show Q2
if Q1A2 then show Q2~3
if Q1A3 then show Q2~4

Before Answering

StatementEngine UnderstandingQ2 Visibility
Initialize, Q2 uses show keyword, following principle 2Hidden
if Q1A1 then show Q2Q1A1 not answered, condition not met, ignore actionHidden
if Q1A2 then show Q2~3Q1A2 not answered, condition not met, ignore actionHidden
if Q1A3 then show Q2~4Q1A3 not answered, condition not met, ignore actionHidden

Final result: Q2 is hidden

After Selecting Q1A2

StatementEngine UnderstandingQ2 Visibility
Initialize, Q2 uses show keyword, following principle 2Hidden
if Q1A1 then show Q2Q1A1 not answered, condition not met, ignore actionHidden
if Q1A2 then show Q2~3Q1A2 answered, condition met, execute actionVisible
if Q1A3 then show Q2~4Q1A3 not answered, condition not met, ignore actionVisible (retained previous state)

Final result: Q2 is visible