Millisecond Forums

checkboxes.checkboxname.selectedcount


https://www.millisecond.com/forums/Topic18911.aspx

By Yuxi - 4/14/2016

Dear all,

I met a problem with checkboxes.checkboxname.selectedcount.
There are 18 checkboxes in the task, each with one option. I asked people to select 6 checkboxes from the 18. Then I want to get the values of the selected 6 options. I wrote a script as below. However, logic expression values.checkboxselect == "1" is always wrong in the 6 trials below. 
Does anyone know why? Any help or information will be appreciated! 

<item Newoptions>
/ 1 = "<% values.option1        
             
                 %>"
/ 2 ="<% values.option2        
             
                 %>"
/ 3 = "<% values.option3        
             
                 %>"
/ 4 = "<% values.option4        
             
                 %>"
/ 5 = "<% values.option5        
             
                 %>"
/ 6 = "<% values.option6        
             
                 %>"
/ 7 = "<% values.option7        
             
                 %>"
/ 8 = "<% values.option8        
             
                 %>"
/ 9 = "<% values.option9        
             
                 %>"
/ 10 = "<% values.option10        
             
                 %>"
/ 11 = "<% values.option11        
             
                 %>"
/ 12 = "<% values.option12        
             
                 %>"
/ 13 = "<% values.option13        
             
                 %>"
/ 14 = "<% values.option14        
             
                 %>"
/ 15 = "<% values.option15        
             
                 %>"
/ 16 = "<% values.option16        
             
                 %>"
/ 17 = "<% values.option17        
             
                 %>"
/ 18 = "<% values.option18        
             
                 %>"
</item>
<item selectedcount>
/ 1 = "<%checkboxes.option1.selectedcount%>"
/ 2 = "<%checkboxes.option2.selectedcount%>"
/ 3 = "<%checkboxes.option3.selectedcount%>"
/ 4 = "<%checkboxes.option4.selectedcount%>"
/ 5 = "<%checkboxes.option5.selectedcount%>"
/ 6 = "<%checkboxes.option6.selectedcount%>"
/ 7 = "<%checkboxes.option7.selectedcount%>"
/ 8 = "<%checkboxes.option8.selectedcount%>"
/ 9 = "<%checkboxes.option9.selectedcount%>"
/ 10 = "<%checkboxes.option10.selectedcount%>"
/ 11 = "<%checkboxes.option11.selectedcount%>"
/ 12 = "<%checkboxes.option12.selectedcount%>"
/ 13 = "<%checkboxes.option13.selectedcount%>"
/ 14 = "<%checkboxes.option14.selectedcount%>"
/ 15 = "<%checkboxes.option15.selectedcount%>"
/ 16 = "<%checkboxes.option16.selectedcount%>"
/ 17 = "<%checkboxes.option17.selectedcount%>"
/ 18 = "<%checkboxes.option18.selectedcount%>"
</item>

<trial Newoption1>
/ ontrialbegin = [values.newoptionA = getitem(item.Newoptions,values.shuffleA1)]
/ ontrialbegin = [values.checkboxselect = getitem(item.selectedcount,values.shuffleA1)]
/ ontrialbegin = [if (values.checkboxselect == "1" ) values.newoption1 = values.newoptionA]
/ ontrialend = [values.shuffleA1 = values.shuffleA1 + 1]
/ branch = [if (values.checkboxselect == "1" ) trial.Newoption2 else trial.Newoption1]
/ timeout =1
</trial>

<trial Newoption2>
/ ontrialbegin = [values.newoptionB = getitem(item.Newoptions,values.shuffleA1)]
/ ontrialbegin = [values.checkboxselect = getitem(item.selectedcount,values.shuffleA1)]
/ ontrialbegin = [if (values.checkboxselect== "1" ) values.newoption2=values.newoptionB]
/ ontrialend = [values.shuffleA1 = values.shuffleA1 + 1]
/ branch = [if (values.checkboxselect== "1" ) trial.Newoption3 else trial.Newoption2]
/ timeout = 1
</trial>

<trial Newoption3>
/ ontrialbegin = [values.newoptionC = getitem(item.Newoptions,values.shuffleA1)]
/ ontrialbegin = [values.checkboxselect = getitem(item.selectedcount,values.shuffleA1)]
/ ontrialbegin = [if (values.checkboxselect== "1" ) values.newoption3=values.newoptionC]
/ ontrialend = [values.shuffleA1 = values.shuffleA1 + 1]
/ branch = [if (values.checkboxselect== "1" ) trial.Newoption4 else trial.Newoption3]
/ timeout = 1
</trial>

<trial Newoption4>
/ ontrialbegin = [values.newoptionD = getitem(item.Newoptions,values.shuffleA1)]
/ ontrialbegin = [values.checkboxselect= getitem(item.selectedcount,values.shuffleA1)]
/ ontrialbegin = [if (values.checkboxselect== "1" ) values.newoption4=values.newoptionD]
/ ontrialend = [values.shuffleA1 = values.shuffleA1 + 1]
/ branch = [if (values.checkboxselect== "1" ) trial.Newoption5 else trial.Newoption4]
/ timeout = 1
</trial>


<trial Newoption5>
/ ontrialbegin = [values.newoptionE = getitem(item.Newoptions,values.shuffleA1)]
/ ontrialbegin = [values.checkboxselect = getitem(item.selectedcount,values.shuffleA1)]
/ ontrialbegin = [if (values.checkboxselect== "1" ) values.newoption5=values.newoptionE]
/ ontrialend = [values.shuffleA1 = values.shuffleA1 + 1]
/ branch = [if (values.checkboxselect== "1" ) trial.Newoption6 else trial.Newoption5]
/ timeout = 1
</trial>

<trial Newoption6>
/ ontrialbegin = [values.newoptionF = getitem(item.Newoptions,values.shuffleA1)]
/ ontrialbegin = [values.checkboxselect = getitem(item.selectedcount,values.shuffleA1)]
/ ontrialbegin = [if (values.checkboxselect== "1" ) values.newoption6=values.newoptionF]
/ ontrialend = [values.shuffleA1 = values.shuffleA1 + 1]
/ branch = [if (values.checkboxselect== "1" ) block.selectionchoosing else trial.Newoption6]
/ timeout = 1
</trial>
By Yuxi - 4/14/2016

Dear there,

Thank you so much! Your answer is very clear! Problem solved!

All the bests!