|
Post by mranalyst on Mar 9, 2023 11:32:09 GMT
Hi, I created a test with 26 questions. At the end of test, the points will be added and a test score is listed. All works correctly till this point.... At the end of test, I want to list only the related text category depending on test score. There are 3 text categories.
Issue: If a participant has a test score which belongs, for example, to category1, the person should see the category1 text, and then the test should end. But it does not work with my code below. The participant sees not only his/her own text category1, but also other both category2 and category3 text in the order specified.
Here is the last part of my code....
l: jump1 t: jump - if $result < 45 then goto category1 - if $result <=> 45-64 then goto category2 - if $result > 64 then goto category3
l: category1 t: info q: <b>0 till 44 points</b><br> Text about category1
l: category2 t: info q: <b>45 till 64 points</b><br> Text about category2
l: category3 t: info q: <b>65 till 78 points</b><br> Text about category3
Any idea how I can correct my code?
|
|
|
Post by alexandra (AEC) on Mar 10, 2023 15:05:40 GMT
Hi there,
this is the case as the code is read after each other. You could quickly solve this problem by adding another jump after category1 and category2. Either you have anyway another question following your text or you just add an "info" text that you can jump to. For example:
l: jump1 t: jump - if $result < 45 then goto category1 - if $result <=> 45-64 then goto category2 - if $result > 64 then goto category3
l: category1 t: info q: <b>0 till 44 points</b><br> Text about category1
l: jump2 t: jump - if $result < 45 then goto endtext
l: category2 t: info q: <b>45 till 64 points</b><br> Text about category2
l: jump3 t: jump - if $result <=> 45-64 then goto endtext
l: category3 t: info q: <b>65 till 78 points</b><br> Text about category3
l: endtext t: info q: You have reached the end.
|
|
|
Post by mranalyst on Mar 10, 2023 17:54:36 GMT
Hi Alexendra, thank you for your response. I tried also with three "jumps" before I wrote in this forum. Your code is sligtly different so that you set all 3 if-statements in "jump1": - if $result < 45 then goto category1 - if $result <=> 45-64 then goto category2 - if $result > 64 then goto category3
Logically I expect in "jump1" only this, not all 3 statements: - if $result < 45 then goto category1
I will try your code too and let you know about the results later.
|
|
|
Post by mranalyst on Mar 12, 2023 18:03:20 GMT
I tested again. No it does not work for "category2".
|
|
|
Post by alexandra (AEC) on Mar 13, 2023 12:25:20 GMT
Hi there, I have tried it out in by just quickly making a "survey" choosing a number (representing your variable in your if statements) usingthe following code: l: question1 t: radio q: Choose a number - 1 - 2 - 3 l: jump1 t: jump - if $question1 == 1 then goto category1 - if $question1 == 2 then goto category2 - if $question1 == 3 then goto category3 l: category1 t: info q: You have chosen number 1. l: jump2 t: jump - if $question1 == 1 then goto endtext l: category2 t: info q: You have chosen number 2 l: jump3 t: jump - if $question1 == 2 then goto endtext l: category3 t: info q: You have chosen number 3 l: endtext t: info q: You have reached the end. And it works. You can try it out via this link: www.psytoolkit.org/c/3.4.4/survey?s=KdZf6Just choose a number and you jump to the correct category and end "question".
|
|