Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Expression Manager Help

Expression Manager Help 2 years 2 months ago #109727

  • dweisser
  • dweisser's Avatar
  • Offline
  • Gold Lime
  • Posts: 222
  • Thank you received: 5
  • Karma: 5
I need to know the count of how many subquestions were clicked in a Multiple choice question.
I need to store this value in a separate question.

I tried: {count(that.q1.NAOK)>0} and {sum(that.q2.NAOK)} this but I can't get a number. The multiple choice questions if clicked evaluate to "Y".

If I have seven subquestions and all seven are clicked, I want to be able to store and use the value "7" in another context.

Anyone have any ideas? Thanks,
David
The administrator has disabled public write access.

Expression Manager Help 2 years 2 months ago #109732

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1805
  • Thank you received: 445
  • Karma: 111
Sometimes simple is the best ;)

All options checked:
{count(that.q1)}

Count + tailor a message (e.g.: singular/plural):
{count(that.q1)} if(count(that.q1)<2,'checkbox checked','checkboxes checked')}

.NAOK suffix is unnecessary for always relevant questions; Obviously, you can add it to your expression if needed.
Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
All LS releases => bit.ly/1VMuTDu | 2.06lts => bit.ly/1Qv44A1
Demo surveys => bit.ly/20NW9V8 (already included in /docs/demosurveys)
Last Edit: 2 years 2 months ago by Ben_V.
The administrator has disabled public write access.

Expression Manager Help 2 years 2 months ago #109752

  • dweisser
  • dweisser's Avatar
  • Offline
  • Gold Lime
  • Posts: 222
  • Thank you received: 5
  • Karma: 5
That completely works. Oh - THANK YOU!
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.815 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form