Welcome to the LimeSurvey Community Forum

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

MCQ - 3 answers, 2 mandatory and 1 optional

  • Janhayled_290772
  • Janhayled_290772's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
2 years 10 months ago - 2 years 10 months ago #216247 by Janhayled_290772
MCQ - 3 answers, 2 mandatory and 1 optional was created by Janhayled_290772
Hi everyone,
For this survey, I want people to choose between two 2 people, A or B.
And if they want, they could tick a 3rd answer "random draw".
I didn't manage to made the choice "Person A" or "Person B" compulsory and at the same time "Random draw" optional with a question validation equation.

I've tried several things :
- I used to assign an assessment value to each subquestion, but it's doesn't work with MCQ, so I used a table : if(sum(Q1_SQ001.value, Q2_SQ002.value) >= 1, 1, 0)
- I tried to use some fomulas : if(Q1_SQ001.question=="Person A", 0, if(Q1_SQ002.question=="Person B", 0, 1))
- Or this formula ("random draw" for the entire SQ003 subquestion) if(Q1_SQ003=="random draw", 0, 1))

With each formulas, in the logical module, I have this formula :
Code:
(VALIDATION: (1) and ((sum( ! (if([url=https://enquetes.unicaen.fr/index.php/admin/questions/sa/view/surveyid/696871/gid/33328/qid/377821]Q1_SQ001.question[/url] == "Person A", 0, if([url=https://enquetes.unicaen.fr/index.php/admin/questions/sa/view/surveyid/696871/gid/33328/qid/377821]Q1_SQ002.question[/url] == "Person B", 0, 1)))) == 0)))
I've looked for other topics on question validation equation, but I didn't find something about this sum. 

File Attachment:

File Name: limesurvey...6871.lss
File Size:26 KB


Please let me know if someone have an idea.
Thanks a lot.
Taka
Attachments:
Last edit: 2 years 10 months ago by Janhayled_290772. Reason: Incomplete first message
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 10 months ago #216250 by tpartner
Replied by tpartner on topic MCQ - 3 answers, 2 mandatory and 1 optional
Try this:

Code:
sum(intval(!is_empty(Q1_SQ001)), intval(!is_empty(Q1_SQ002))) == 1

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: Janhayled_290772
The topic has been locked.
  • Janhayled_290772
  • Janhayled_290772's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
2 years 10 months ago #216252 by Janhayled_290772
Replied by Janhayled_290772 on topic MCQ - 3 answers, 2 mandatory and 1 optional
Many thanks, it works :)

Kind regards

Taka
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 10 months ago #216254 by holch
Wait. You have 3 answers. Either Person A, or Person B or random.

Isn't that simply a single choice question with 3 answer options??

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.
  • Janhayled_290772
  • Janhayled_290772's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
2 years 10 months ago #216267 by Janhayled_290772
Replied by Janhayled_290772 on topic MCQ - 3 answers, 2 mandatory and 1 optional
Hello Holch,

Here are the possible answer pattern :
- Person A
- Person B
- Person A + random
- Person B + random

I don't want people to pick "random" alone without choosing between A and B, and indeed the formula Tony gave work perfectly.

Many thanks to you and Tony :)

Taka
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 10 months ago #216303 by holch
Ahhh, OK, this didn't make sense to me. Now it is clearer.

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.

Lime-years ahead

Online-surveys for every purse and purpose