Problems with the if statement


Problems with the if statement

Author
Message
beccca
beccca
Esteemed Member
Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)

Group: Forum Members
Posts: 13, Visits: 11

Hello everyone


I'm pretty new in the whole coding thing and I have a problem. Actually two problems..


Background:


People have 4 decks with cards. They chose cards and can either win or lose some money (Iowa Gambling Task; IGT)


After they played the IGT they are asked to toss a coin. In question1 they have to specify if head is deck A and B and tail is deck C and D or the other wayaround (head = C and D; tail = A and B)


Question2 then asks whether heads or tail was shown.



1. Problem:


I have for conditions:


- c1: Subject chose A in question1 and A in question2


-  c2: Subject chose A in question1 and B in question2


- c3: Subject chose B in question1 and A in question2


- c4: Subject chose B in question1 and B in question2



After the subject answered the first two questions I want to show a specific sentence depending on what the subject answered.


--> c1: 'You chose A and A which means you can now play with the decks A and B'


--> c2: 'You chose A and B which means you can now play with the decks C and D'


--> c3: 'You chose B and A which means you can now play with the decks C and D'


--> c4: 'You chose B and B which means you can now play with the decks A and B'



But I don't know how to do that. I tried so many things but I could get the whole thing to run correctly... I tried it with the /branch attribute and if-statements.


I tried to create a string variable and show the sentence with <% item.sentence.item %> depending on what the subject answered (if (radiobuttons.question1.response == "A") <% item.sentence.item %> (I tried this in like 100 different ways; I also tried text.sentence.text) but the /branch attribute doesn't accept <% %>.


after that I tried to use a variable which tried to specify it depending on the answers and than post the variable with the <%%>. Did'nt work either.


Does anyone have an idea how I could do it?



2. Problem


Is pretty similia to the first one (also with if statements)


I want to filter the subjects depending on the answer they gave to a specific question.


If a subject said YES to the answer then he/she has to answer the questions on surveypage 6. 


If a ssubject said NO to the answer then he/she can directly go to surveypage 9.


I tried to do it like that:



<survey coininstruction>


/ pages = [1=coininstruction; 2=coindecision; 3=zufallpage; 4=sicherheit; 5=neu; 6=coininstruction_neu; 7=coindecision2; 8=zufallpage2; 9=defdecision; 10=entscheidung]


/ responsefontstyle = ("Arial", 1.75%)


/ itemfontstyle = ("Arial", 1.75%)


/ itemspacing = 2%


/ showpagenumbers = false


/ showbackbutton = false


/ finishlabel = "NEXT"


/ showquestionnumbers = false


/ branch = [if (radiobuttons.neu.response == "No") surveypage.defdecision]


</survey>


But, again, it does not work like that. I don't even get an errormessage. Inquisit just totally ignores it.



Thank you for any ideas you guys have Smile


Dave
Dave
Supreme Being
Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)

Group: Administrators
Posts: 9.8K, Visits: 46K


1. Problem:


I have for conditions:


- c1: Subject chose A in question1 and A in question2


-  c2: Subject chose A in question1 and B in question2


- c3: Subject chose B in question1 and A in question2


- c4: Subject chose B in question1 and B in question2



After the subject answered the first two questions I want to show a specific sentence depending on what the subject answered.


--> c1: 'You chose A and A which means you can now play with the decks A and B'


--> c2: 'You chose A and B which means you can now play with the decks C and D'


--> c3: 'You chose B and A which means you can now play with the decks C and D'


--> c4: 'You chose B and B which means you can now play with the decks A and B'



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

<surveypage mypage>
/ questions = [1=q1; 2=q2]
/ branch = [if (radiobuttons.q1.response==radiobuttons.q2.response) surveypage.ab else surveypage.cd]
</surveypage>

<radiobuttons q1>
/ options = ("A", "B")
</radiobuttons>

<radiobuttons q2>
/ options = ("A", "B")
</radiobuttons>

<surveypage ab>
/ caption = "'You chose <%radiobuttons.q1.response%> and <%radiobuttons.q2.response%> which means you can now play with the decks A and B."
</surveypage>

<surveypage cd>
/ caption = "'You chose <%radiobuttons.q1.response%> and <%radiobuttons.q2.response%> which means you can now play with the decks C and D."
</surveypage>



2. Problem


Is pretty similia to the first one (also with if statements)


I want to filter the subjects depending on the answer they gave to a specific question.



See the examples at http://www.millisecond.com/forums/Topic5461.aspx#5461



beccca
beccca
Esteemed Member
Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)Esteemed Member (2.3K reputation)

Group: Forum Members
Posts: 13, Visits: 11

I could solve the second problem (thank you so much for that Smile), but still not the first one...


It always shows the "from now on you have to choose fromt he decks c or d" but not the other version (decks a or b). 



1. people have to chose, what heads or tail stands for:


option1: "Heads stands for decks A and B and tails stands for decks C and D"


option2: "Heads stands for decks C and D and tails stands for decks A and B"



2. people have to toss the coin and tell what it showed:


option1: "Heads"


option2: "Tails"



and here's the thing now:


If they chose "Heads stands for decks A and B and tails stands for decks C and D" and the coin showed "Heads" than case1 should be shown:


<surveypage case1>


/caption = "This means from now on you can only chose between the decks A and B"


</surveypage>


case1 sould also be shown if they chose "Heads stands for decks C and D and tails stands for decks A and B" and the coin showed "Tails".



If they chose "Heads stands for decks A and B and tails stands for decks C and D" and the coin showed "Tails" than case 2 should be shown:


<surveypage case2>


/caption = "This means from now on you can only chose between the decks C and D"


</surveypage>


case2 should also be shown if they chose "Heads stands for decks C and D and tails stands for decks A and B" and the coin showed "Heads".



And additionally:


After they saw that they are asked whether or not they want to toss the coin again. If they answer "Yes" the whole thing is going on again.


Any ideas...?



Thank you Smile


Dave
Dave
Supreme Being
Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)

Group: Administrators
Posts: 9.8K, Visits: 46K

Well, as you can see, you can do this rather straightforwardly by modifying the code I posted to:


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

<surveypage mypage>
/ questions = [1=q1; 2=q2]
/ branch = [if (radiobuttons.q1.response=="H_AB"  && radiobuttons.q2.response=="H") surveypage.ab]
/ branch = [if (radiobuttons.q1.response=="H_AB"  && radiobuttons.q2.response=="T") surveypage.cd]
/ branch = [if (radiobuttons.q1.response=="H_CD"  && radiobuttons.q2.response=="H") surveypage.cd]
/ branch = [if (radiobuttons.q1.response=="H_CD"  && radiobuttons.q2.response=="T") surveypage.ab]
</surveypage>

<radiobuttons q1>
/ options = ("Heads = A and B, Tails = C and D", "Heads = C and D, Tails = A and B")
/ optionvalues = ("H_AB", "H_CD")
</radiobuttons>

<radiobuttons q2>
/ options = ("Heads", "Tails")
/ optionvalues = ("H", "T")
</radiobuttons>

<surveypage ab>
/caption = "This means from now on you can only chose between the decks A and B."
/ questions = [1=repeat]
/ branch = [if (dropdown.repeat.response=="Yes") surveypage.mypage]
</surveypage>

<surveypage cd>
/caption = "This means from now on you can only chose between the decks C and D."
/ questions = [1=repeat]
/ branch = [if (dropdown.repeat.response=="Yes") surveypage.mypage]
</surveypage>

<dropdown repeat>
/ caption = "Repeat?"
/ options = ("Yes", "No")
</dropdown>


Please work through this until you fully understand it. Then adapt it to your own needs.


GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search