Millisecond Forums

How to reference a clicked survey response for value calculations...

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

By mcfubb - 10/21/2013

Hey,


I have a survey on which participants respond either by clicking radiobuttons or values from a dropdown menu.


I want to add to certain values I have coded depending on the response for each survey item. I can't seem to figure out how to reference the values that are clicked, whether radiobutton or dropdown, such that Inquisit understands what values I want to correspond to each response.


Please see a sample of the script below, which shows the values I want to update, and the radiobutton and surveypage (including the values I'm trying to update at the ontrialend/ part):



<values>


/networkdiversity=0


/numberofpeople=0


</values>



<radiobuttons marital>


/caption = "Marital Status"


/options = ("Currently married & living together, or living with someone in marital-like relationship", 


"Never married & never lived with someone in a marital-like relationship",


"Separated", "Divorced or formerly lived with someone in a marital-like relationship", "Widowed")


</radiobuttons>



<surveypage page1>


/caption = "1. Which of the following best describes your marital status?"


/questions = [1=marital]


/showpagenumbers = false


/showquestionnumbers = false


/ ontrialend = [if(radiobuttons.marital.response == "Currently married & living together, or living with someone in marital-like relationship")


values.networkdiversity = values.networkdiversity + 1;


if(radiobuttons.marital.response = "Currently married & living together, or living with someone in marital-like relationship")


values.numberofpeople = values.numberofpeople + 1]


</surveypage>




Could someone please let me know how to do this correctly?


Thanks.


-Daniel

By Dave - 10/21/2013

<values>
/networkdiversity=0
/numberofpeople=0
</values>
 
<radiobuttons marital>
/caption = "Marital Status"
/options = ("Currently married & living together, or living with someone in marital-like relationship",
"Never married & never lived with someone in a marital-like relationship",
"Separated", "Divorced or formerly lived with someone in a marital-like relationship", "Widowed")
</radiobuttons>

<surveypage page1>
/caption = "1. Which of the following best describes your marital status?"
/questions = [1=marital]
/showpagenumbers = false
/showquestionnumbers = false
/ ontrialend = [if(radiobuttons.marital.response == "Currently married & living together, or living with someone in marital-like relationship")
values.networkdiversity = values.networkdiversity + 1;
if(radiobuttons.marital.response == "Currently married & living together, or living with someone in marital-like relationship")
values.numberofpeople = values.numberofpeople + 1]
</surveypage>

<block myblock>
/ trials = [1=page1]
</block>

<data>
/ columns = [response, values.networkdiversity, values.numberofpeople]
</data>


works just fine.

By mcfubb - 10/21/2013

Hey Dave,


Thanks for your quick response and for pointing out the "==" mistake.


Perhaps I should have included more of my script info. I used the <survey> element to arrange the pages of my survey, and then referenced that as my block in the overall experiment...perhaps that's why there's an issue. I get a separate datafile for the survey output, in addition to the main output from my other blocks. 


so my arrangement is: 


<survey SNI>

/pages=[1=page1; 2=page2; 3=page3; 4=page4; 5=page5; 6=page6; 7=page7; 8=page8; 9=page9; 10=page10; 11=page11; 12=page12]

</survey>



<expt>

/blocks = [1 = learning; 2 = empathysurvey; 3 = recognition; 4 = lonelinesssurvey; 5 = fssqsurvey; 6 = sni ]

/postinstructions = (outro)

</expt>



I included the values in my <data> columns and the columns show up, but the values stay at zero. I believe the issue has to do with the fact that the survey output is being written to a separate data file, which does not include the columns for my values (it is a horizontal arrangement of data with each survey item, latency, and response). Perhaps using the survey element is the issue...


Any ideas of what I'm doing wrong? Perhaps I should not use the <survey> element but rather the <block> element as you did and arrange them as trials so it all writes to the same datafile and that will solve the issue...I will try that out.


Thanks,

Daniel
By Dave - 10/21/2013

Yes, the issue is that you cannot customize data output for <survey> elements. You need to use <block> instead.

By mcfubb - 10/21/2013

That clears things up. Thanks Dave!