Conditional branching from block to surveypage


Author
Message
clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49



Hi!


I’m having some trouble with conditional branching from an openended to
a radiobutton question. I’m trying to design a task where participants are
first asked an initial question and then receive a follow-up question only if
they answered the first question but not if they didn’t. The initial question is
an open-ended question, where participants have the option to answer or not
answer. If they enter an answer
(which I now, for convenience, score as correct), then I want to branch to a
radiobutton question. However, I keep getting error messages. Maybe somebody
here has a clue?


This is part of my script:


 


1.      
1. The openended question


<openended Question>


/ stimulusframes = [1=question]


/ mouse=false


/ position= (50, 80)


/ charlimit = 100


/ numlines = 5


/ linelength = 20


/ buttonlabel = "Press Enter to Continue"


/ correctresponse = (anyresponse)


/ responsetime = 60000


/ timeout = 60000


</openended>


 


2.    2. The follow-up question


<radiobuttons followup>


/ caption = "Did you the answer the first question by
guessing?"


/ options=("Yes", "No")


/ required=true


</radiobuttons>


 


3.      
3. A surveypage element for the follow up-question


<surveypage followupQuestion>


/ questions = [1 = followup]


</surveypage>


 


 


4.      
4. A block containing my openended question


<block myQuestion>


/ trials = [1 = Question]


/ branch = [if (openended.Question.response = (anyresponse))
surveypage.followupQuestion]


</block>


 


Here is where it goes wrong. I also tried this alternative:

 


<block myQuestion>


/ trials = [1 = Question]


/ branch = [if (openended.Question.correct = 1)
surveypage.followupQuestion]


</block>



Or this:


 


<block myQuestion>


/ trials = [1 = Question]


/ branch = [if (block.myQuestion.correct = 1)
surveypage.followupQuestion]


</block>


 


Each time, I get the error message that expression
‘openended.Question.correct’ or ‘block.myQuestion.correct’, or whatever else I
put in the if statement, is invalid. Can somebody give me a tip?


Thanks in advance!



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

#1: You *don't* want your /branch to reside in the <block> element. It needs to reside in the <openended>.


#2: Your /branch syntax is faulty. It needs to be


/ branch = [if (openended.Question.correct == 1)
surveypage.followupQuestion]


or better yet


/ branch = [if (openended.Question.response != "")
surveypage.followupQuestion]


Regards,


~Dave


clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49

Hi Dave,



Thanks for the quick reply!


Unfortunately, it doesn't quite work yet. I didn't try the first option, since I now do want to specify specific responses as correct responses (which is another problem I haven't figured out yet, by the way). I tried the second option, but now I get to the followup Question every time, regardless whether I enter anything or not.



Best, Claire


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

To define correct responses, use the <openended>'s /correctresponse or /iscorrectresponse attribute.


Then check the conditional logic in your /branch attributes.


/ branch = [if (openended.Question.response != "")
surveypage.followupQuestion]


will only trigger the follow-up <surveypage> if the response is NOT (!=) empty.


clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49



Hi Dave,


 


Thanks again for the quick reply! Unfortunately, the line / branch = [if
(openended.Question.response != "") surveypage.followupQuestion]
doesn't do the trick for me. I guess it would work perfectly if I just wanted to ask a single question.
However, I have a task with a whole bunch of different questions (and potential
follow up questions). Thus, several repetitions of the same trial with
different stimulus items (/questions). Now I noticed that the line you propose works well if I never enter any response. However, once a participant has entered a
response on any given trial, every following trial will automatically branch to the
followup question, even if the person doesn't so much as touch the keyboard. Is there any way around this?


My problem second problem, concerning the correct
response, is related to this as well, I think. Since I present a series of different
questions, I also have a series of different correct answers. So I tried the
following:


<text Question>

/items = question

/position = (50, 50)

/size = (800, 100)

/fontstyle = ("Arial", 3.12%, true, false, false, false, 5, 1)

/txcolor = (0, 0, 225)

/halign = center

/select = noreplace

</text>






<item question>


/ 1 = "blah bla blah ...1 ?"


/ 2 =  "blah bla blah ...2 ?"

...


/ 15 = "blah bla blah ...15 ?"  


</item>






<item answer>

/ 1 = "answer1"

/ 2 = "answer2"   

... 

/ 15 = "answer15"   

</item>



 


<openended Question>

/ stimulusframes = [1=Question]

/ mouse=false

/ position= (50, 60)

/ charlimit = 100

/ numlines = 3

/ linelength = 20

/ fontstyle = ("Arial", 2.00%, false, false, false, false, 5, 1)

/ buttonlabel = "You have one minute to type an answer"

/ correctresponse = ("item.answer")

/ timeout = 6000

/ branch = [if (openended.Question.response !=
"")
surveypage.insight]

</openended>


 


I don't get an error message with this, but every response is just scored as incorrect.


I don't know if you can even specify the correct response as a list of items. I just tried it because it sounded logical and I couldn't think of any other way to do it. Any ideas?


 


Thanks in advance,


Claire



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

For dynamically defined correct responses, you need to use /iscorrectresponse.


Something like this should work:


<openended question>
/ stimulusframes = [1=myquestion]
/ validresponse = (anyresponse)
/ iscorrectresponse = [openended.question.response==getitem(item.myansweritems, text.myquestion.currentindex)]
/ branch = [if(openended.question.correct) trial.followup]
</openended>

<text myquestion>
/ items = myquestionitems
/ select = noreplace
/ position = (50%, 30%)
</text>

<item myquestionitems>
/ 1 = "Q_01"
/ 2 = "Q_02"
/ 3 = "Q_03"
/ 4 = "Q_04"
</item>

<item myansweritems>
/ 1 = "A_01"
/ 2 = "A_02"
/ 3 = "A_03"
/ 4 = "A_04"
</item>

<trial followup>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%openended.question.response%>")
</text>

<block myblock>
/ trials = [1-4=question]
</block>


Regards,


~Dave


clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49

Hi Dave,



The iscorrectresponse option works (at least as long as participants don't hit the enter key, but I guess this is just a problem I have to live with).


The branching, however, is still a problem. I don't want to branch to the follow-up surveypage if the response is correct, but if there is any answer at all. What you proposed before ( / branch = [if (openended.question.response != "") surveypage.follow-up] ) worked well for the first trial, but not after that. Somehow the line openended.question.response != "" must not refer to the last/current response to the openended question. Because once I have entered a response to the question on any given trial, I get the follow-up surveypage on every next trial, even if I don't enter a response.


I'm sorry to keep bothering you! I try to figure these things out by myself as much as I can, but I am really clueless here and I find that there are not many resources other than this forum to learn these things from.



Best, Claire



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

The branching, however, is still a problem. I don't want to branch to the follow-up surveypage if the response is correct, but if there is any answer at all. What you proposed before ( / branch = [if (openended.question.response != "") surveypage.follow-up] ) worked well for the first trial, but not after that. Somehow the line openended.question.response != "" must not refer to the last/current response to the openended question. Because once I have entered a response to the question on any given trial, I get the follow-up surveypage on every next trial, even if I don't enter a response.


I realized that. Unfortunately there's a bug that prevents the response-property from being cleared in case of an empty response, i.e. then the previous response persists.


A hack-ish workaround would be


/ branch = [if(openended.question.firstcharlatency>0) trial.followup]


which will however fail in case a participants types something but then deletes it again.


As for learning Inquisit syntax, I recommend you


- work through all the tutorials included in the Inquisit documentation


- study the "How to" section


- look up details in the "Language Reference" section


- work through a given number of scripts from the Task Library to see various coding techniques in action.


clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49

Thanks! The firstlatency>0 works well.


And as for your tips; that's pretty much what I'm doing. Especially going through scripts from the library is very helpful.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search