How to count number of multi choice boxes checked

More
2 years 11 months ago - 2 years 11 months ago #107834 by Qsgt
Can someone please five me some code to count the number of multi choice check boxes that a user has checked. I have attached a copy of the question.



I would like to put in an equation that says something along the lines of you have selected to attend on x days. Where x is the number of selected dates.

Thanks
qsgt
Attachments:
Last Edit: 2 years 11 months ago by Qsgt.

Please Log in to join the conversation.

More
2 years 11 months ago #107849 by Ben_V
Hello,

Use the following snippet into an equation question type (just replace "QQ" by your correct multiple choice question code):
{count(that.QQ)}

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: DenisChenu, Qsgt

Please Log in to join the conversation.

More
2 years 11 months ago #107868 by Qsgt
Hi,

OK thanks,

could you clarify some things for me:

If my question is in a different group do I have to include the group number? If so what format do I use? Because I want to count multiple check boxes what format do I use?

Thanks,
qsgt

Please Log in to join the conversation.

More
2 years 11 months ago #107880 by Ben_V
No, you don't have to include the group number... just beware that your multiple choice question code is unique in your survey...

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: Qsgt

Please Log in to join the conversation.

More
2 years 11 months ago #107928 by Qsgt
Hi,

I have more that one question that is multiple choice I do I reference what question I want in the equation I have tried setting it up so that each subquestion has a different question but it just comes up as a syntax error.

Thanks very much for the help so far it is much appreciated.

qsgt

Please Log in to join the conversation.

More
2 years 11 months ago #107932 by Ben_V
Please import the attached sample survey and have a look... I hope it contains all expected answers to your question

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Attachments:
The following user(s) said Thank You: Qsgt

Please Log in to join the conversation.

More
2 years 11 months ago #107935 by Qsgt
When I try to import in file I get the following message:

This is not a valid LimeSurvey survey structure XML file.

Also is it possible to save the number outputted for use in another equation?

Sorry for the hassel,
qsgt

Please Log in to join the conversation.

More
2 years 11 months ago #107938 by Ben_V
Sorry, try with the new export...

You can reuse "{count(that.Q1)}", "{count(that.Q2)}" etc... wherever you want and manage all kind of mathematical operation. Results will be save automatically into the DB.

For example to sum the results (in a new equation):
{sum(count(that.q1))+(count(that.q2))}

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Attachments:
The following user(s) said Thank You: Qsgt

Please Log in to join the conversation.

More
2 years 9 months ago #109483 by Qsgt
Thanks a lot worked perfectly

qsgt

Please Log in to join the conversation.