Forum Discussion
Multiple AND and OR conditions in the same trigger
I've run into a scenario when I am implementing a "show layer X" trigger 5 times (with different conditions), when I really should be just using one trigger (with all conditions combined). How does storyline evaluate a trigger with conditions that include both AND and OR statements?
For example :
- WaltHamiltonSuper Hero
You will need two triggers:
Jump to next slide when learner clicks on Policy button.
Show layer "Please Read Policy First Popup" when timeline ends on this slide.
FYI, this seems to me like a strange request. Are you sure you don't need to refine the definition of your question a bit more?
- PeatragayMckayCommunity Member
Hello,
I am trying to use the trigger to do this action:
When a user click on the policy button they can move to the next slide, if they do not click the policy button they get a popup saying" Please make sure to ready the policy" and they will not be able to move to the next page without clicking that policy button.
- RadosawKwasek-9Community Member
Hi,
I made a test file (ST2) to check how trigger's conditions works. The answer is unfortunately: do not mix "and" & "or" conditions. Download and check Yourself.
- MattOckenfels-cCommunity Member
Seven years later and I have come up with this issue. Thanks for this tester.
I started by modifying the results display:
Note the AND groupings. I worked through different scenarios and the logic seems correct.
Additionally, the current formatting of the trigger conditions lead to this conclusion:
The ANDs are indented, leading me to believe they are evaluated before the ORs.
Can any of our hard-working Articulate reps confirm I am on the right track? Thanks!
- NedimCommunity Member
Let's put it this way: in JavaScript, where && represents AND and || represents OR, the evaluation would follow these rules:
Trigger 1:
let result = (var1 && var2) || (var3 && var4);- If both var1 and var2 are true, result will be true.
- If both var3 and var4 are true, result will also be true.
- If neither of these conditions is satisfied, result will be false.
Trigger 2:
let result = (var1 && var2) || var3 || var4;- If both var1 and var2 are true, result will be true.
- If either var3 or var4 is true, result will also be true.
- If none of these conditions is satisfied, result will be false.
Trigger 3:
let result = var1 || (var2 && var3) || var4;- If var1 is true, result will be true.
- If both var2 and var3 are true, result will be true.
- If var4 is true, result will be true.
- If none of these conditions are met, result will be false.
Needless to say, when both && and || operators are used in an expression/trigger, the AND operator will be evaluated first. I'd say your logic seems correct, but I’d suggest breaking it down the JavaScript way, especially when the conditions in the trigger become complex with too many mixed OR and AND statements.
- RajuMNCommunity Member
hi
got the answer,
i got it with include options.
thanks for baring me
- RajuMNCommunity Member
Dear friends,
few of my friends are discussing how make test more interesting,
like
getting limited questions from question bank each time:
for example if we have 50 questions in question bank each time( attempt ) can we get 20 different question ?
- RajuMNCommunity Member
thanks for the help Michale
- MichaelHinzeCommunity MemberYou could use question banks and randomly draw questions from them. Here is some info on question banks.
Raju M N said:
Hi friends,
can some one will help me in this:
when i take the test i know how to shuffle answers,but can we shuffle questions also?
if it can be done -it will be interesting .
thanks in advance
- RajuMNCommunity Member
Hi friends,
can some one will help me in this:
when i take the test i know how to shuffle answers,but can we shuffle questions also?
if it can be done -it will be interesting .
thanks in advance
Hi Raju,
Since Presenter doesn't have the same set up with triggers you won't be able to determine a specific slide the user should go to based on their quiz results.
- RajuMNCommunity Member
Dear Friends,
can we do this in presenter also ?
little curious how to do it in presenter-" can we take the user to different slides based on the quiz result ".
is this possible?
thanks