Welcome to the LimeSurvey Community Forum

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

Unique() answers on tabe

  • apoggio
  • apoggio's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
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

File Attachment:

File Name: limesurvey...8412.lss
File Size:19 KB
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #162419 by tpartner
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
  • apoggio's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
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.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #162433 by tpartner
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):

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:

File Attachment:

File Name: limesurvey...4121.lss
File Size:20 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: apoggio
The topic has been locked.
  • apoggio
  • apoggio's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
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.
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
6 years 3 months ago #162445 by LouisGac
Replied by LouisGac on topic Unique() answers on tabe

apoggio wrote: Thanks a lot.

Is ther a place/documentation on functions we can use in LimeSurvey with exemples ?


Turn debug mode on, then click on the configuration menu, you'll find a link to all the EM functions:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #162452 by tpartner
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.

Lime-years ahead

Online-surveys for every purse and purpose