Millisecond Forums

Skip function not working

https://forums.millisecond.com/Topic18471.aspx

By SuzannaA - 3/1/2016

Hello,

I'm trying to get a Risk Assessment as an eligibility screening for the experiment. If participants answer the first question with "neither down nor good", "good", or "very good", then I would like to skip the next question ("In the last two weeks, have you felt so down that you have had plans of ending your life?").

If for the second question, they answer "yes", I would like the experiment to be aborted, with the caption "This is the end of the experiment. Please call your experimenter".

The script was working but now it seems to not be working at all and only the first question runs. 
I'm not sure what I'm doing wrong. Could you please have a look and suggest how I could fix this?

---------------- Script ----------------------

<text moodrating>
/items = ("How has your mood been these last two weeks?")
/fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/halign = center
/position = (30%, 30%)
/color = (15, 190, 253)
/txcolor = (black)
</text>

<likert mood>
/stimulusframes = [1=moodrating]
/anchors = [1 = "very down/bad"; 2 = "down/bad"; 3 = "neither down nor good"; 4 = "good"; 5 = "very good"]
</likert>

<radiobuttons suicide>
/caption = "In the last two weeks, have you felt so down that you have had plans of ending your own life?"
/options = ("Yes", "No")
/required = true
</radiobuttons>

<surveypage suicideax>
/questions = [1=suicide]
/showpagenumbers = false
/backbuttonposition = (10%, 90%)
/nextbuttonposition = (90%, 90%)
/skip = [radiobuttons.suicide.response == "neither down nor good"; "good"; "very good"]
</surveypage>

<surveypage callexperimenter>
/caption = "This is the end of the experiment. Please call your experimenter"
/nextbuttonposition = (90%, 90%)
/finishlabel = "Exit"
/skip = [surveypage.suicideax.response == "No"]
</surveypage>


<block risk>
/trials = [1 = mood; 2= suicideax; 3= callexperimenter]
</block>
---------------------------------------------------

Thank you!
By Dave - 3/1/2016

---------------- Script ----------------------

<text moodrating>
/items = ("How has your mood been these last two weeks?")
/fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/halign = center
/position = (30%, 30%)
/color = (15, 190, 253)
/txcolor = (black)
</text>

<likert mood>
/stimulusframes = [1=moodrating]
/anchors = [1 = "very down/bad"; 2 = "down/bad"; 3 = "neither down nor good"; 4 = "good"; 5 = "very good"]
</likert>

<radiobuttons suicide>
/caption = "In the last two weeks, have you felt so down that you have had plans of ending your own life?"
/options = ("Yes", "No")
/required = true
</radiobuttons>

<surveypage suicideax>
/questions = [1=suicide]
/showpagenumbers = false
/backbuttonposition = (10%, 90%)
/nextbuttonposition = (90%, 90%)
/ skip = [likert.mood.response == "3" || likert.mood.response == "4" || likert.mood.response == "5"]
/ branch = [if (radiobuttons.suicide.response == "Yes") surveypage.callexperimenter ]

</surveypage>

<surveypage callexperimenter>
/ ontrialend = [script.abort(); ]
/caption = "This is the end of the experiment. Please call your experimenter"
/nextbuttonposition = (90%, 90%)
/finishlabel = "Exit"
</surveypage>

<block risk>
/trials = [1 = mood; 2= suicideax]
</block>
---------------------------------------------------

should do what you need (changes in bold). The /ontrialend in <surveypage callexperimenter> is optional at present, but is needed to terminate the entire study in case other blocks, etc. would normally follow <block risk>.



By SuzannaA - 3/2/2016

Thank you!