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


Author
Message
mcfubb
mcfubb
Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)
Group: Forum Members
Posts: 3, Visits: 1

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


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: 12K, Visits: 98K

<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.


mcfubb
mcfubb
Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)
Group: Forum Members
Posts: 3, Visits: 1

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

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: 12K, Visits: 98K

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


mcfubb
mcfubb
Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)Partner Member (792 reputation)
Group: Forum Members
Posts: 3, Visits: 1

That clears things up. Thanks Dave!


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search