- Posts: 21
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Unique() answers on tabe
- apoggio
- Topic Author
- Offline
- Junior Member
Less
More
6 years 3 months ago #162413
by apoggio
Unique() answers on tabe was created by apoggio
Hello,
I have a table with 4 choices and 3 answers possible.
Answers are % of working time in a place.
I would like to limit answers depending on the %.
Exemple:
For answer A1 --> less than 20% the user can select all the answers
For answer A2 --> 30 to 50 % the user can only make 3 answers
For answer A3 --> more than 50% the user can select only 1 answers.
I've tried with unique() key word on question expression, but I don't understand the syntax.
Thank you for your help.
PS: Attache the servey with the question
I have a table with 4 choices and 3 answers possible.
Answers are % of working time in a place.
I would like to limit answers depending on the %.
Exemple:
For answer A1 --> less than 20% the user can select all the answers
For answer A2 --> 30 to 50 % the user can only make 3 answers
For answer A3 --> more than 50% the user can select only 1 answers.
I've tried with unique() key word on question expression, but I don't understand the syntax.
Thank you for your help.
PS: Attache the servey with the question
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10104
- Thank you received: 3593
6 years 3 months ago #162419
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 Unique() answers on tabe
I would reconsider the question type. Even with those restrictions, you could get a total over 100.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- apoggio
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 0
6 years 3 months ago #162423
by apoggio
Replied by apoggio on topic Unique() answers on tabe
Hello Thanks for the answer.
I know, but it is not really the goal of reaching the 100% it is more find the technical way to achieve this behavior.
I know, but it is not really the goal of reaching the 100% it is more find the technical way to achieve this behavior.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10104
- Thank you received: 3593
6 years 3 months ago #162433
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 Unique() answers on tabe
In that case, I would think something like this should work (line-breaks inserted for clarity):
Sample survey attached:
Code:
sum(self.sq_SQ001 == 'A1', self.sq_SQ002 == 'A1', self.sq_SQ003 == 'A1', self.sq_SQ004 == 'A1') <= 3 AND sum(self.sq_SQ001 == 'A2', self.sq_SQ002 == 'A2', self.sq_SQ003 == 'A2', self.sq_SQ004 == 'A2') <= 2 AND sum(self.sq_SQ001 == 'A3', self.sq_SQ002 == 'A3', self.sq_SQ003 == 'A3', self.sq_SQ004 == 'A3') <= 1
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: apoggio
The topic has been locked.
- apoggio
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 0
6 years 3 months ago #162441
by apoggio
Replied by apoggio on topic Unique() answers on tabe
Thanks a lot.
Is ther a place/documentation on functions we can use in LimeSurvey with exemples ?
It works fine, I do understand a little bit better the syntax.
Is ther a place/documentation on functions we can use in LimeSurvey with exemples ?
It works fine, I do understand a little bit better the syntax.
The topic has been locked.
- LouisGac
- Visitor
6 years 3 months ago #162445
by LouisGac
Replied by LouisGac on topic Unique() answers on tabe
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10104
- Thank you received: 3593
6 years 3 months ago #162452
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 Unique() answers on tabe
Documentation on Expression Manager here -
manual.limesurvey.org/Expression_Manager
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.