- Posts: 41
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
URGENT: Count number of selected answer options in an array
- jackuars
- Topic Author
- Offline
- Senior Member
Less
More
6 years 2 months ago - 6 years 2 months ago #163931
by jackuars
URGENT: Count number of selected answer options in an array was created by jackuars
Q0. With what frequency do you use these social media platforms? (Array question)
I want to see if a user has selected atleast 3 social media platforms under "Several times a day" or "Once a day"
That is a user becomes a Elite Social media user if he has selected atleast 3 social media platforms under the options "Several times a day" or "Once a day"
I tried this under Q1 but it doesn't work.
Q1. Elite social media user (Yes/No hidden question): Default answer: Yes
count((Q0_1.NAOK == "1" or Q0_1.NAOK == "2"), (Q0_2.NAOK == "1" or Q0_2.NAOK == "2"), (Q0_3.NAOK == "1" or Q0_3.NAOK == "2"), (Q0_4.NAOK == "1" or Q0_4.NAOK == "2") >= 3)
The output shows Yes under Q1 if any social media platform is selected under the option "Several times a day" or "Once a day" else it shows N/A
I want to see if a user has selected atleast 3 social media platforms under "Several times a day" or "Once a day"
That is a user becomes a Elite Social media user if he has selected atleast 3 social media platforms under the options "Several times a day" or "Once a day"
I tried this under Q1 but it doesn't work.
Q1. Elite social media user (Yes/No hidden question): Default answer: Yes
count((Q0_1.NAOK == "1" or Q0_1.NAOK == "2"), (Q0_2.NAOK == "1" or Q0_2.NAOK == "2"), (Q0_3.NAOK == "1" or Q0_3.NAOK == "2"), (Q0_4.NAOK == "1" or Q0_4.NAOK == "2") >= 3)
The output shows Yes under Q1 if any social media platform is selected under the option "Several times a day" or "Once a day" else it shows N/A
Last edit: 6 years 2 months ago by jackuars.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
6 years 2 months ago #163947
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic URGENT: Count number of selected answer options in an array
You need to use sum(), not count().
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- jackuars
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 0
6 years 2 months ago #164050
by jackuars
Replied by jackuars on topic URGENT: Count number of selected answer options in an array
Thanks!
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
6 years 2 months ago #164061
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic URGENT: Count number of selected answer options in an array
Clearly not very URGENT.
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: holch
The topic has been locked.
- jackuars
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 0
6 years 2 months ago #164062
by jackuars
Replied by jackuars on topic URGENT: Count number of selected answer options in an array
Hi tpartner,
I had to dig in through the forums before I found the "sum" feature and was able to find it before you replied (luckily). But thanks for your help as always.
I had to dig in through the forums before I found the "sum" feature and was able to find it before you replied (luckily). But thanks for your help as always.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
6 years 2 months ago #164081
by holch
That is great, but then the right thing to do would be post back here that you solved the problem and ideally show your solution. Otherwise you are wasting valuable time of posters here, that could already be spent on other issues, because yours was solved already. Just for the future. This forum is mainly run by volunteers who do this for free and in their spare time.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic URGENT: Count number of selected answer options in an array
jackuars wrote: Hi tpartner,
I had to dig in through the forums before I found the "sum" feature and was able to find it before you replied (luckily). But thanks for your help as always.
That is great, but then the right thing to do would be post back here that you solved the problem and ideally show your solution. Otherwise you are wasting valuable time of posters here, that could already be spent on other issues, because yours was solved already. Just for the future. This forum is mainly run by volunteers who do this for free and in their spare time.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.