- Posts: 7
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
limit answers in an array
- etretout
- Topic Author
- Offline
- New Member
Less
More
6 years 4 months ago #160647
by etretout
limit answers in an array was created by etretout
Hi,
I would like to limit answers in an array
Example with the capture
I would to limit A to 2 answers and the same thing for B. The maximum answers for the array is 4
Could you help me ?
Thanks
I would like to limit answers in an array
Example with the capture
I would to limit A to 2 answers and the same thing for B. The maximum answers for the array is 4
Could you help me ?
Thanks
Attachments:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12713
- Thank you received: 3924
6 years 4 months ago - 6 years 4 months ago #160649
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic limit answers in an array
Just count the answers of each column.
Read: manual.limesurvey.org/Expression_Manager....27that.27_variables
and
[url=Implemented Functions]Implemented Functions[/url]
I used "countifop"
Then you do a question validation like (count of column A < 3) and (count of column B < 3)
Best regards
Joffm
Read: manual.limesurvey.org/Expression_Manager....27that.27_variables
and
[url=Implemented Functions]Implemented Functions[/url]
I used "countifop"
Then you do a question validation like (count of column A < 3) and (count of column B < 3)
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 years 4 months ago by Joffm.
The topic has been locked.
- etretout
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
6 years 4 months ago #160651
by etretout
Replied by etretout on topic limit answers in an array
thks
i have to do a question validation like : count(question1.A1) and count(question1.A2)
i have to do a question validation like : count(question1.A1) and count(question1.A2)
The topic has been locked.
- etretout
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
6 years 4 months ago #160655
by etretout
Replied by etretout on topic limit answers in an array
thx
how countiftop works in my case ?
how countiftop works in my case ?
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12713
- Thank you received: 3924
6 years 4 months ago - 6 years 4 months ago #160657
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic limit answers in an array
{countifop("==","A1",self)} with A1 = code of answer option
It's obvious: You count the whole question if the option is "equal A1".
Joffm
It's obvious: You count the whole question if the option is "equal A1".
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 years 4 months ago by Joffm.
The topic has been locked.
- etretout
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
6 years 4 months ago #160751
by etretout
Replied by etretout on topic limit answers in an array
ok thx
i would like to limit at 2 answers
i tried with : {countifop("<","A1",3)} but it doesn't work
i would like to limit at 2 answers
i tried with : {countifop("<","A1",3)} but it doesn't work
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12713
- Thank you received: 3924
6 years 4 months ago #160763
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic limit answers in an array
Of course. this cannot work.
What do you do?
1. You compare with a text. What is smaller than "A1"? What is smaller than "etretout"?
Text you can only compare "equal or not equal".
Therefore I always pray: Do not use these silly default codes like "A1", "A2". Use numeric codes.
2. What is this "3". Here you enter the column or row or entire question you want to count.
Why did you try to change my formula?
{countifop("==","A1",self)} with A1 = code of answer option.
In the actual question ("self") it counts the amount of code A1 in all subquestions. To count the codes A2, you set {countifop("==","A2",self)}
And to limit your question you combine both in the question validation:
((countifop("==","A1",self)) and (countifop("==","A2",self)))
Still okay:
Too many in clolumn 2.
Joffm
What do you do?
1. You compare with a text. What is smaller than "A1"? What is smaller than "etretout"?
Text you can only compare "equal or not equal".
Therefore I always pray: Do not use these silly default codes like "A1", "A2". Use numeric codes.
2. What is this "3". Here you enter the column or row or entire question you want to count.
Why did you try to change my formula?
{countifop("==","A1",self)} with A1 = code of answer option.
In the actual question ("self") it counts the amount of code A1 in all subquestions. To count the codes A2, you set {countifop("==","A2",self)}
And to limit your question you combine both in the question validation:
((countifop("==","A1",self)) and (countifop("==","A2",self)))
Still okay:
Too many in clolumn 2.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.