Millisecond Forums

select brand based on selection questions in survey elements

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

By MichelleSnelleman - 5/31/2019

Good day,
Currently I am working on a brand association test using 4 different brands, 1 brand is always in the task, the other three brands are competitors of the first brand. I've built the task for all brands and all is working fine.
Selection of the competing brand needs to be done based on survey questions. These questions have branching as well:
Q1: answers -> a-g. Answers a,b,c,f,g go to Q2, answers d and e go to the brand association task for competitor HR
Q2: answer a -> competitor HH
       answer b -> competitor HvA
       answer c -> competitor HR
       answer d-> Q3

Q3: answer a -> competitor HH
       answer b -> competitor HvA
       answer c -> competitor HR
       answer d-> competitor HR

I've tried to use the batch element with a selection survey, does not work. Branching also does not seem to work. Also tried responsetrial but does not seem to work.

What are your suggestions? Thanks so much in advance!

Kind regards,
Michelle Snelleman

By Dave - 6/2/2019

MichelleSnelleman - 6/1/2019
Good day,
Currently I am working on a brand association test using 4 different brands, 1 brand is always in the task, the other three brands are competitors of the first brand. I've built the task for all brands and all is working fine.
Selection of the competing brand needs to be done based on survey questions. These questions have branching as well:
Q1: answers -> a-g. Answers a,b,c,f,g go to Q2, answers d and e go to the brand association task for competitor HR
Q2: answer a -> competitor HH
       answer b -> competitor HvA
       answer c -> competitor HR
       answer d-> Q3

Q3: answer a -> competitor HH
       answer b -> competitor HvA
       answer c -> competitor HR
       answer d-> competitor HR

I've tried to use the batch element with a selection survey, does not work. Branching also does not seem to work. Also tried responsetrial but does not seem to work.

What are your suggestions? Thanks so much in advance!

Kind regards,
Michelle Snelleman


Branching would be the way to go as opposed to using a <batch> approach. What you've done wrong I can't say, since you didn't share any of the relevant code.
By MichelleSnelleman - 6/3/2019

Dave - 6/3/2019

Branching would be the way to go as opposed to using a <batch> approach. What you've done wrong I can't say, since you didn't share any of the relevant code.

Dear Dave,

Tjanks for your reply, I've included my code as an attachment. Thanks again for your valuable advice!

Kind regards, 
Michelle
By Dave - 6/3/2019

MichelleSnelleman - 6/3/2019
Dave - 6/3/2019

Branching would be the way to go as opposed to using a <batch> approach. What you've done wrong I can't say, since you didn't share any of the relevant code.

Dear Dave,

Tjanks for your reply, I've included my code as an attachment. Thanks again for your valuable advice!

Kind regards, 
Michelle

Thanks for the script, but:

#1: Please take the time and actually point to the relevant sections of the code and please refer to the relevant elements exactly as they are named in the script. There is not a single /branch attribute in the script you attached, so I'm not sure how I am supposed to figure out where in your previous attempts at branching you went wrong.
#2: I also see nothing in the script that matches any "brand selection", i.e. something resembling

Selection of the competing brand needs to be done based on survey questions. These questions have branching as well:
Q1: answers -> a-g. Answers a,b,c,f,g go to Q2, answers d and e go to the brand association task for competitor HR
Q2: answer a -> competitor HH
       answer b -> competitor HvA
       answer c -> competitor HR
       answer d-> Q3

Q3: answer a -> competitor HH
       answer b -> competitor HvA
       answer c -> competitor HR
       answer d-> competitor HR"

Where is that code?

#3: The script seems incomplete in other ways:

<expt>
...
/ blocks = [1 = demographicsselect; 2 = HHPracticeAssociationStrength; 3 = HHAssociationStrength; 4 = surveypage.demographics2; 5 = demographics3; 6 = ]
</expt>

Where and what is block #6?

#4: If you have code that relies on any external files to run (e.g. images), please always provide those files as well. The script alone is of limited use.

Thanks.
By MichelleSnelleman - 6/4/2019


Dear Dave, 

My apologies for providing incomplete code. Attached is the complete code including all brands and coding for branching. Picture stimuli were also added as attachment.

Kind regards,
Michelle
By Dave - 6/4/2019

MichelleSnelleman - 6/5/2019

Dear Dave, 

My apologies for providing incomplete code. Attached is the complete code including all brands and coding for branching. Picture stimuli were also added as attachment.

Kind regards,
Michelle

Thanks for the code.

The branching doesn't work for several reasons.

#1: Your /branch attributes are in the wrong place altogether. You cannot /branch from survey *question* elements (e.g. <radiobuttons>):

<radiobuttons huidigeopleiding>
/ caption = "Welke opleiding volg je nu?"
/ options = ("havo", "vwo", "mbo", "Hogeschool Rotterdam opleiding Communicatie", "Inholland opleiding Creative Business", "Inholland opleiding Communicatie","Ik volg op dit moment geen opleiding","Ik volg een andere opleiding")
/ branch = [
if (trial.huidigeopleiding="havo", "vwo", "mbo","Ik volg op dit moment geen opleiding","Ik volg een andere opleiding") trial.hogeschooloverwogen)
if (trial.huidigeopleiding="Hogeschool Rotterdam opleiding Communicatie", "Inholland opleiding Creative Business") expt.HR
]
</radiobuttons>

/branch attributes ought to reside at the <surveypage>, <trial>, <survey>, or <block> level.

#2: The /branch syntax is all wrong.
- A <radiobuttons> element is not a trial.
- trial.huidigeopleiding would return nothing anyway
- "havo", "vwo", "mbo","Ik volg op dit moment geen opleiding","Ik volg een andere opleiding" is not how a response would look.

#3: You cannot /branch to <expt> elements.

#4: A /branch must remain at the same level: a <trial> can /branch to another <trial>. A <block> can /branch to another <block>. A <trial> cannot /branch to a <block>. A <block> cannot /branch to a <trial>.
(Note that a <surveypage> is a kind of <trial> and a <survey> is a kind of <block>, i.e. a <surveypage> can /branch to a <trial> and vice versa. A <survey> can /branch to a <block> and vice versa.)

#5: You're also trying to run <surveypage>s via the <expt>s' /blocks. That won't work. As explained above, a <surveypage> is a <trial>, not a <block>. You need to set up <block> or <survey> elements to execute the surveypages and then run those blocks/surveys.

What you'll want to do is have ONE <expt> element in the script, like this:

<expt>
/ onexptbegin = [

values.responsekey_yes = parameters.responsekey_left;
values.responsekeyyes_label = parameters.responsekeyleft_label;
values.responsekey_no = parameters.responsekey_right;
values.responsekeyno_label = parameters.responsekeyright_label;
values.yes_x = parameters.left_x;
values.no_x = parameters.right_x;
values.yesresponse = "LEFT";
values.noresponse = "RIGHT";
]

/ postinstructions = (End)
/ onexptend = [values.completed = 1]
/ blocks = [1 = demographicsselect]
</expt>

Then, from <block demographicsselect> /branch to the applicable condition <block> based on the response to the selection questions. From there, you can /branch to the other blocks for the selected school unconditionally.


By Dave - 6/4/2019

Dave - 6/5/2019
MichelleSnelleman - 6/5/2019

Dear Dave, 

My apologies for providing incomplete code. Attached is the complete code including all brands and coding for branching. Picture stimuli were also added as attachment.

Kind regards,
Michelle

Thanks for the code.

The branching doesn't work for several reasons.

#1: Your /branch attributes are in the wrong place altogether. You cannot /branch from survey *question* elements (e.g. <radiobuttons>):

<radiobuttons huidigeopleiding>
/ caption = "Welke opleiding volg je nu?"
/ options = ("havo", "vwo", "mbo", "Hogeschool Rotterdam opleiding Communicatie", "Inholland opleiding Creative Business", "Inholland opleiding Communicatie","Ik volg op dit moment geen opleiding","Ik volg een andere opleiding")
/ branch = [
if (trial.huidigeopleiding="havo", "vwo", "mbo","Ik volg op dit moment geen opleiding","Ik volg een andere opleiding") trial.hogeschooloverwogen)
if (trial.huidigeopleiding="Hogeschool Rotterdam opleiding Communicatie", "Inholland opleiding Creative Business") expt.HR
]
</radiobuttons>

/branch attributes ought to reside at the <surveypage>, <trial>, <survey>, or <block> level.

#2: The /branch syntax is all wrong.
- A <radiobuttons> element is not a trial.
- trial.huidigeopleiding would return nothing anyway
- "havo", "vwo", "mbo","Ik volg op dit moment geen opleiding","Ik volg een andere opleiding" is not how a response would look.

#3: You cannot /branch to <expt> elements.

#4: A /branch must remain at the same level: a <trial> can /branch to another <trial>. A <block> can /branch to another <block>. A <trial> cannot /branch to a <block>. A <block> cannot /branch to a <trial>.
(Note that a <surveypage> is a kind of <trial> and a <survey> is a kind of <block>, i.e. a <surveypage> can /branch to a <trial> and vice versa. A <survey> can /branch to a <block> and vice versa.)

#5: You're also trying to run <surveypage>s via the <expt>s' /blocks. That won't work. As explained above, a <surveypage> is a <trial>, not a <block>. You need to set up <block> or <survey> elements to execute the surveypages and then run those blocks/surveys.

What you'll want to do is have ONE <expt> element in the script, like this:

<expt>
/ onexptbegin = [

values.responsekey_yes = parameters.responsekey_left;
values.responsekeyyes_label = parameters.responsekeyleft_label;
values.responsekey_no = parameters.responsekey_right;
values.responsekeyno_label = parameters.responsekeyright_label;
values.yes_x = parameters.left_x;
values.no_x = parameters.right_x;
values.yesresponse = "LEFT";
values.noresponse = "RIGHT";
]

/ postinstructions = (End)
/ onexptend = [values.completed = 1]
/ blocks = [1 = demographicsselect]
</expt>

Then, from <block demographicsselect> /branch to the applicable condition <block> based on the response to the selection questions. From there, you can /branch to the other blocks for the selected school unconditionally.



Here's a simplified example that should give you the general idea:

<expt>
/ blocks = [1=select_school]
</expt>

<block select_school>
/ trials = [1=selectionpage]
/ branch = [
if (radiobuttons.selectionquestion.response == "School A") block.School_A_Block_1
else if (radiobuttons.selectionquestion.response == "School B") block.School_B_Block_1
else if (radiobuttons.selectionquestion.response == "School C") block.School_C_Block_1;
]
</block>

<surveypage selectionpage>
/ questions = [1=selectionquestion]
</surveypage>

<radiobuttons selectionquestion>
/ caption = "Please select your school"
/ options = ("School A", "School B", "School C")
</radiobuttons>

// School A
<block School_A_Block_1>
/ trials = [1=exampletrial]
/ branch = [
block.School_A_Block_2
]
</block>

<block School_A_Block_2>
/ trials = [1=exampletrial]
/ branch = [
block.School_A_Block_3
]
</block>

<block School_A_Block_3>
/ trials = [1=exampletrial]
</block>

// School B
<block School_B_Block_1>
/ trials = [1=exampletrial]
/ branch = [
block.School_B_Block_2
]
</block>

<block School_B_Block_2>
/ trials = [1=exampletrial]
/ branch = [
block.School_B_Block_3
]
</block>

<block School_B_Block_3>
/ trials = [1=exampletrial]
</block>

// School C
<block School_C_Block_1>
/ trials = [1=exampletrial]
/ branch = [
block.School_C_Block_2
]
</block>

<block School_C_Block_2>
/ trials = [1=exampletrial]
/ branch = [
block.School_C_Block_3
]
</block>

<block School_C_Block_3>
/ trials = [1=exampletrial]
</block>

<trial exampletrial>
/ stimulusframes = [1=exampletext]
/ validresponse = (57)
/ timeout = 5000
</trial>

<text exampletext>
/ items = ("This is <%script.currentblock%>")
</text>


By MichelleSnelleman - 6/5/2019


Dear Dave,

Thanks for your elaborate and clear response. I've adjusted my script accordingly but I still encounter some errors. I'm not sure what I'm doing wrong.
I've attached the adjusted script and stimuli for your reference.

Thanks again!

Kind regards, 
Michelle
By Dave - 6/5/2019

MichelleSnelleman - 6/5/2019

Dear Dave,

Thanks for your elaborate and clear response. I've adjusted my script accordingly but I still encounter some errors. I'm not sure what I'm doing wrong.
I've attached the adjusted script and stimuli for your reference.

Thanks again!

Kind regards, 
Michelle

<trial INHPracticeBrand>
/ ontrialbegin = [
trial.INHPracticeBrand.insertstimulustime(clearscreen, parameters.brandduration);
trial.INHPracticeBrand.insertstimulustime(text.INHPractice_association, parameters.brandduration);
trial.INHPracticeBrand.insertstimulustime(text.yes, parameters.brandduration);
trial.INHPracticeBrand.insertstimulustime(text.no, parameters.brandduration);
]
/ stimulustimes = [0 = INHPracticebrand]
/ beginresponsetime = parameters.brandduration
/ responseinterrupt = immediate
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ ontrialend = [
if (trial.INHPracticeBrand.response == values.responsekey_yes)
values.response = "PAST WEL"
else
values.response = "PAST NIET";
values.brand = picture.INHPracticebrand.currentitem;
values.association = text.INHPractice_association.currentitem;
trial.INHPracticeBrand.resetstimulusframes();
]
/ posttrialpause = parameters.iti
</trial>

There is no <picture> element called "INHPracticebrand" anywhere in the script.

<trial HHPracticeBrand>
/ ontrialbegin = [
trial.HHPracticeBrand.insertstimulustime(clearscreen, parameters.brandduration);
trial.HHPracticeBrand.insertstimulustime(text.HH_practice_association, parameters.brandduration);
trial.HHPracticeBrand.insertstimulustime(text.yes, parameters.brandduration);
trial.HHPracticeBrand.insertstimulustime(text.no, parameters.brandduration);
]
/ stimulustimes = [0 = HHPractice]
/ beginresponsetime = parameters.brandduration
/ responseinterrupt = immediate
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ ontrialend = [
if (trial.HHPracticeBrand.response == values.responsekey_yes)
values.response = "PAST WEL"
else
values.response = "PAST NIET";
values.brand = picture.PracticeBrand2.currentitem;
values.association = text.HHPractice_association.currentitem;
trial.HHPracticeBrand.resetstimulusframes();
]
/ posttrialpause = parameters.iti
</trial>

There is no <picture> element called "PracticeBrand2" anywhere in the script.

<trial HRPracticeBrand>
/ ontrialbegin = [
trial.HRPracticeBrand.insertstimulustime(clearscreen, parameters.brandduration);
trial.HRPracticeBrand.insertstimulustime(text.HRPractice_association, parameters.brandduration);
trial.HRPracticeBrand.insertstimulustime(text.yes, parameters.brandduration);
trial.HRPracticeBrand.insertstimulustime(text.no, parameters.brandduration);
]
/ stimulustimes = [0 = PracticeBrand3]
/ beginresponsetime = parameters.brandduration
/ responseinterrupt = immediate
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ ontrialend = [
if (trial.HRPracticeBrand.response == values.responsekey_yes)
values.response = "PAST WEL"
else
values.response = "PAST NIET";
values.brand = picture.PracticeBrand3.currentitem;
values.association = text.PracticeBrand3association.currentitem;
trial.HRPracticeBrand.resetstimulusframes();
]
/ posttrialpause = parameters.iti
</trial>

There is no <picture> element called "PracticeBrand3" anywhere in the script.

<trial HVAPractice>
/ ontrialbegin = [
trial.HVAPractice.insertstimulustime(clearscreen, parameters.brandduration);
trial.HVAPractice.insertstimulustime(text.HvAPractice_association, parameters.brandduration);
trial.HVAPractice.insertstimulustime(text.yes, parameters.brandduration);
trial.HVAPractice.insertstimulustime(text.no, parameters.brandduration);
]
/ stimulustimes = [0 = PHVAPractice]
/ beginresponsetime = parameters.brandduration
/ responseinterrupt = immediate
/ validresponse = (parameters.responsekey_left, parameters.responsekey_right)
/ ontrialend = [
if (trial.HVAPractice.response == values.responsekey_yes)
values.response = "PAST WEL"
else
values.response = "PAST NIET";
values.brand = picture.PracticeBrand4.currentitem;
values.association = text.PracticeBrand4association.currentitem;
trial.HVAPractice.resetstimulusframes();
]
/ posttrialpause = parameters.iti
</trial>

There is no stimulus element called "PHVAPractice" anywhere in the script.
There is no <picture> element called "PracticeBrand4" anywhere in the script.

<block HHAssociationStrength>
/ trials = [1 = instructions; 2-87 = noreplace(Merk1, Merk2)]
/ branch = [ survey.HHvragen
]
</block>

<block HHPracticeAssociationStrength>
/ trials = [1 = instructions; 2-9 = noreplace(PracticeBrand1, PracticeBrand2)]
/ branch = [
block.HHAssociationStrength
]
</block>

<block HRAssociationStrength>
/ trials = [1 = instructions; 2-87 = noreplace(Merk1)]
/ branch = [
survey.HRvragen
]
</block>

<block HRPracticeAssociationStrength>
/ trials = [1 = instructions; 2-9 = noreplace(PracticeBrand1, PracticeBrand3)]
/ branch = [
block.HRAssociationStrength
]
</block>

<block HvAAssociationStrength>
/ trials = [1 = instructions; 2-87 = noreplace(Merk1, Merk4)]
/ branch = [
survey.HVAvragen
]
</block>

<block HvAPracticeAssociationStrength>
/ trials = [1 = instructions; 2-9 = noreplace(PracticeBrand1, PracticeBrand4)]
/ branch = [
block.HvAAssociationStrength
]
</block>

There are no <trial> elements called PracticeBrand1, PracticeBrand2, PracticeBrand3, PracticeBrand4, Merk1, Merk3 and Merk4 anywhere in the script.

<block select_3>
/ trials = [1=surveypage.select3]
/ branch = [
if (radiobuttons.kenanderehogeschool.response == "Haagse Hogeschool") block.HHPracticeAssociationStrength
else if (radiobuttons.kenanderehogeschool.response == "Hogeschool Rotterdam"; "geen van bovenstaande") block.HRPracticeAssociationStrength
else if (radiobuttons.kenanderehogeschool.response == "Hogeschool van Amsterdam") block.HvAPracticeAssociationStrength;
]
</block>

This is not valid syntax. It ought to read

else if (radiobuttons.kenanderehogeschool.response == "Hogeschool Rotterdam" || radiobuttons.kenanderehogeschool.response == "geen van bovenstaande") block.HRPracticeAssociationStrength

<text instructions>
/ items = instructions
/ select = sequence
/ size = (100%, 80%)
/ vjustify = center
/ hjustify = center
/ fontstyle = ("Arial", 3%, true, false, false, false, 5, 1)
/ resetinterval = 0
</text>

There is no <item> element called "instructions" anywhere in the script.
By MichelleSnelleman - 6/7/2019


Dear Dave,

Thanks very much for your feedback, everything is running great now!
 One final question: when running the script on Inquisit web, at first everything was ok but today I ran a test trial and the answers for the selection question were displayed as symbols, not as letters on Windows 10 pc, not on Macbook or iPhone. I did not change the script between the first and second test run. Is there an explanation for this?

Kind regards,
Michelle
By Dave - 6/7/2019

MichelleSnelleman - 6/7/2019

Dear Dave,

Thanks very much for your feedback, everything is running great now!
 One final question: when running the script on Inquisit web, at first everything was ok but today I ran a test trial and the answers for the selection question were displayed as symbols, not as letters on Windows 10 pc, not on Macbook or iPhone. I did not change the script between the first and second test run. Is there an explanation for this?

Kind regards,
Michelle

First time I've heard of such a thing. Could you post a link to the web experiment's start page so I can check whether I can replicate this under Windows 10?
By MichelleSnelleman - 6/7/2019

Dave - 6/7/2019
MichelleSnelleman - 6/7/2019

Dear Dave,

Thanks very much for your feedback, everything is running great now!
 One final question: when running the script on Inquisit web, at first everything was ok but today I ran a test trial and the answers for the selection question were displayed as symbols, not as letters on Windows 10 pc, not on Macbook or iPhone. I did not change the script between the first and second test run. Is there an explanation for this?

Kind regards,
Michelle

First time I've heard of such a thing. Could you post a link to the web experiment's start page so I can check whether I can replicate this under Windows 10?

https://mili2nd.co/yhnb

Here's the link
By Dave - 6/7/2019

MichelleSnelleman - 6/7/2019
Dave - 6/7/2019
MichelleSnelleman - 6/7/2019

Dear Dave,

Thanks very much for your feedback, everything is running great now!
 One final question: when running the script on Inquisit web, at first everything was ok but today I ran a test trial and the answers for the selection question were displayed as symbols, not as letters on Windows 10 pc, not on Macbook or iPhone. I did not change the script between the first and second test run. Is there an explanation for this?

Kind regards,
Michelle

First time I've heard of such a thing. Could you post a link to the web experiment's start page so I can check whether I can replicate this under Windows 10?

https://mili2nd.co/yhnb

Here's the link

You've specified the "symbol" character set in the default fontstyle:

<defaults>
/canvasaspectratio = (4,3)
/minimumversion = "5.0.0.0"
/ fontstyle = ("Arial", 4%, false, false, false, false, 5, 2) <-- HERE
/txbgcolor = black
/ txcolor = white
/ screencolor = black
</defaults>



You should specify standard ANSI as the character set instead:

<defaults>
/canvasaspectratio = (4,3)
/minimumversion = "5.0.0.0"
/ fontstyle = ("Arial", 4%, false, false, false, false, 5, 0)
/txbgcolor = black
/ txcolor = white
/ screencolor = black
</defaults>