Welcome to the LimeSurvey Community Forum

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

Question validation equation ("yes" must be selected to move to next group)

  • tisopenpeerreview
  • tisopenpeerreview's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 6 months ago #226241 by tisopenpeerreview
Your LimeSurvey version: 5.2.13
Own server or LimeSurvey hosting: Germany
Survey theme/template: Vanilla
==================

Dear all,
I'm having some issues creating a question validation equation. I've created an array question with six sub-questions and two possible answers (yes, no). Participants need to answer "yes" to the first five sub-questions to move to the next group, and the answer to the sixth one is up to them. I've created the following validation equation, but it is not working.

(SQ001 == AO01) and (SQ002 == AO01) and (SQ003 == AO01) and (SQ004 == AO01) and (SQ005 == AO01)

I have no previous knowledge about coding, so I would be very grateful for any help you can give me. I have uploaded a screenshot of the question, whose code is G07Q39.

Thank you all in advance,

Christian
Attachments:

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
2 years 6 months ago #226242 by DenisChenu
(SQ001.NAOK == "AO01") and (SQ002.NAOK == "AO01") and (SQ003.NAOK == "AO01") and (SQ004.NAOK == "AO01") and (SQ005.NAOK == "AO01")

1. Usage of NAOK : manual.limesurvey.org/Expression_Manager#Usage_of_NAOK
2. Variable : manual.limesurvey.org/Expression_Manager#Access_to_Variables (here AO01 is not a variable, it's a value).

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 6 months ago #226245 by Joffm
And to add:
[url] manual.limesurvey.org/ExpressionScript_-...code_variable_naming [/url]

1. The answer option code "AO01" is a text, not a number; therefore it has to be surrounded by quotes.
2. As you read in the link above, a variable is accessed either by
  • "single punch question: "QCode"
  • "multiple questions, arrays, multiple text, multiple numeric": "QCode_SubquestionCode"
  • "array(text), array(number): "QCode_SubquestionCodeYAxis_SubquestionCodeXAxis"
  • "dual array": "QCode_SubquestionCode_ScaleID"

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • tisopenpeerreview
  • tisopenpeerreview's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 6 months ago #226246 by tisopenpeerreview
Dear all,

It works perfectly now! Thank you both so much for your help! I've learnt a lot today  .
Best wishes,

Christian

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 6 months ago #226248 by Joffm
By the way:
you can validate this more easily by:
countif("AO02",self)==0
or
countif("AO01",self)==5
or (if you use numeric codes (1,2) instead of ythe dehault "AO01",...
sum(self)<6

Read the manual about implemented functions 
[url] manual.limesurvey.org/ExpressionScript_-...mplemented_functions [/url]

and
[url] manual.limesurvey.org/ExpressionScript_-....22that.22_variables [/url]

And:
Why do you display this question instead of the private policy option?

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose