Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Count radio list answers and display boilerplate text

  • SIMOON
  • SIMOON's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 5 months ago #142919 by SIMOON
I think this link can help.
I never used it but in your case, it should be something like:
Code:
if(sum(if(Q01==1,1,0), if(Q02==1,1,0), if(Q03==1,1,0))>sum(if(Q01==2,1,0), if(Q02==2,1,0), if(Q03==2,1,0)),"You chose option 1 more then option 2","")

Note than I just used the condition in the example you linked, just use your own. ->if([condition1] > [condition2],"you chose option 1 more...","");
The following user(s) said Thank You: Antonimo
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 5 months ago #142929 by tpartner
I would simplify it by using 2 hidden equation questions (let's call them equation1 and equation2) to record the counts of "Option 1" and "Option 2". Something like this in those questions:
Code:
{sum(Q1=='A1', Q2=='A1', Q3=='A1', Q4=='A1', Q5=='A1')}
Code:
{sum(Q1=='A2', Q2=='A2', Q3=='A2', Q4=='A2', Q5=='A2')}

Then, you can use something like this in the boilerplate:
Code:
{if(equation1 > equation2, 'You answered "Option 1" more than "Option 2"', 'You answered "Option 2" more than "Option 1"')}

Sample survey attached.

File Attachment:

File Name: limesurvey...5342.lss
File Size:23 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Antonimo
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 weeks ago #149462 by Joffm
Hi, Antonimo,

You see that it is displayed "group by group".
So this relevance avoids the display of the boilerplate until all 5 questions are answered.
Otherwise it would show up after the first question is answered, because the condition "equation1 > equation2" might be true.

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: tpartner
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose