Display Logic Engine
Basic Principles
Using show
and hide
keywords indicates display logic.
The DSL engine follows these 3 principles when running:
- Questions are visible by default
- If a question uses
show
, it becomes hidden by default - 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
Statement | Engine Understanding | Q2 Visibility |
---|---|---|
Initialize, Q2 uses show keyword, following principle 2 | Hidden | |
if Q1A1 then show Q2 | Q1A1 not answered, condition not met, ignore action | Hidden |
Final result: Q2 is hidden
After Selecting Q1A1
Statement | Engine Understanding | Q2 Visibility |
---|---|---|
Initialize, Q2 uses show keyword, following principle 2 | Hidden | |
if Q1A1 then show Q2 | Q1A1 answered, condition met, execute action | Visible |
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
Statement | Engine Understanding | Q2 Visibility |
---|---|---|
Initialize, Q2 uses show keyword, following principle 2 | Hidden | |
if Q1A1 then show Q2 | Q1A1 not answered, condition not met, ignore action | Hidden |
if Q1A2 then show Q2~3 | Q1A2 not answered, condition not met, ignore action | Hidden |
if Q1A3 then show Q2~4 | Q1A3 not answered, condition not met, ignore action | Hidden |
Final result: Q2 is hidden
After Selecting Q1A2
Statement | Engine Understanding | Q2 Visibility |
---|---|---|
Initialize, Q2 uses show keyword, following principle 2 | Hidden | |
if Q1A1 then show Q2 | Q1A1 not answered, condition not met, ignore action | Hidden |
if Q1A2 then show Q2~3 | Q1A2 answered, condition met, execute action | Visible |
if Q1A3 then show Q2~4 | Q1A3 not answered, condition not met, ignore action | Visible (retained previous state) |
Final result: Q2 is visible