In experience sampling or longitudinal studies, researchers often want to show or hide questions based on how a participant answered earlier in the same session. However, Avicenna’s criteria system — by default — evaluates all past answers submitted by the participant, not just the ones from the current session.
This can lead to unexpected behavior: a question appears even though the one it depends on was never shown. Or logic fires based on a value answered days ago.
In this article, we’ll show you how to make sure your criteria always reference the latest answers — that is, the answers from the current session only.
What to Do?
-
Start by identifying your current logic setup. Here’s a common example:
Q1 [Single answer: Yes(1) / No(2)] Q2 [Number], shown if Q1 == 1 Q5 [Text], shown if Q2 > 1
Problem: If Q1 is now 2 (so Q2 doesn’t show), but Q2 was answered in a previous session, Q5 might still appear — because
Q2 > 1
is technically true from the old response. -
Update the criteria to include the full condition chain. Change Q5’s criteria from:
Q2 > 1
to:
Q1 == 1 AND Q2 > 1
This ensures Q2 was visible in the current session and answered.
-
Make Q1 a mandatory question.
This is crucial — if Q1 isn’t mandatory, Avicenna can’t reliably tell if Q2’s response is from the current session or a past one. Without this, the fix won’t work consistently.
-
Apply the same pattern to all dependent questions. If you have more questions that rely on Q2, their logic should also reference Q1:
Q6 → Q1 == 1 AND Q2 > 1 Q7 → Q1 == 1 AND Q2 > 2 Q8 → Q1 == 1 AND Q2 > 2
-
(Optional) Use parentheses for clarity. When combining multiple conditions, wrap them for readability:
(Q1 == 1) AND (Q2 > 2)
-
Preview your flow and test it. Try answering Q1 with both values. Confirm that:
- Q2 only shows if Q1 == 1
- Q5–Q8 only appear if Q2 is visible and has a matching value
- No questions appear based on answers from previous sessions
---
Pro Tips
- Don’t trust Q2’s value unless you’ve checked Q1. If Q2 depends on Q1, include Q1 in every logic block that evaluates Q2.
- Make Q1 mandatory. This ensures Avicenna knows the answer to Q1 in the current session, so it can correctly evaluate dependent questions.
- Avicenna stores all past responses. If you don’t restrict logic to this session, you risk using outdated answers.
- Keep criteria readable. For multi-step dependencies, break the logic into clear conditions using
AND
.
Wrap-Up
When building conditional flows, criteria only work as expected if they refer to the current session’s answers. To make sure they do:
- Always include the full dependency chain in each condition.
- Make the earliest dependent question (here, Q1) mandatory — without this, the system can’t reliably evaluate conditions involving later questions.
- Test with different response paths.
This one fix — adding Q1 == 1
to your criteria and making Q1 mandatory — saves time, avoids logic bugs, and makes your activity behavior consistent across all devices.