Welcome to the LimeSurvey Community Forum

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

Terminate Survey based on an answer in a 5-point array question

  • j_kour
  • j_kour's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 4 days ago #233577 by j_kour
Your LimeSurvey version:  5.4.9+221101
Own server

I have several question groups. In one of the groups, there is a 5-item array question with 5 sub-questions. Let's say that the code of a question is TQ1.

I want to terminate the survey if the answer to TQ1 is different from the 5th item in the answer.

I tried to add a quota but the sub-items in the array are not recognised.
Then in the next question, I add a condition TQ1=='5' (or, should it be TQ1==5). When I try the survey, the cut-off condition does not work.

Any ideas how to implement it?

Thanks 
 

Please Log in to join the conversation.

More
2 years 4 days ago #233579 by jelo

I want to terminate the survey if the answer to TQ1 is different from the 5th item in the answer.
 
I recommend to add a small LSS export of the relevant questions here. That will prevent a lot of misunderstanding and wild guessing.

E.g what is TQ1? Is it a 5-point-array question with 5 sub-questions? If yes, than TQ1 has five sub-question. And there is no answer to TQ1, only to the five sub-questions.
The survey should continue if in one sub-question the answer is 1,2,3 or 4. If the answer is 5, the survey should end?

A subquestion in an array has a subquestioncode. E.g.SQ001, SQ002 etc.
If I want to access the answer of SQ001 of question TQ1, the variable would be TQ1_SQ001.
If check against the 5th answer item, you would use  TQ1_SQ001.NAOK == 5

To be save for different scenarios you might add a check for emptiness of the variable.
The ! in !is_empty inverse it to "Is not empty".
Code:
((( !is_empty(TQ1_SQ001.NAOK) && (TQ1_SQ001.NAOK == 5))))
 

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

  • j_kour
  • j_kour's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 4 days ago #233580 by j_kour
Hi,

No, TQ1 is your TQ1_SQ001. I got how it works.

Is it possible to use TQ1 in Quota too?

Thanks

Please Log in to join the conversation.

  • j_kour
  • j_kour's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 4 days ago #233581 by j_kour
Should that be TQ1_SQ001 == 5? Why do I need the .NAOK?

Please Log in to join the conversation.

More
2 years 4 days ago #233582 by jelo

No, TQ1 is your TQ1_SQ001. I got how it works.
 
Once again, upload a short survey with the relevant questions for your question.
If you got how it works, I wonder why you want to access the answercode in an array question via TQ1. That is not working, cause you have no underscore, which Questioncode_Subquestion
Take a look at the naming conventions.
www.limesurvey.org/manual/Expression_Man...code_Variable_Naming

You might don't need NAOK in simple equations.
Using NAOK, means that all or some of the variables are irrelevant (e.g. "Not Applicable" (NA) is alright (OK)).
If you build bigger ExpressionScripts NAOK often prevents nasty bugs cause an empty variable without NAOK turns the whole equation empty.
So many prefer to use NAOK everywhere.

The 5point array is a supported question type by the Quota system.
www.limesurvey.org/manual/Survey_quotas#...orted_question_types
 

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 days ago #233596 by tpartner
Quotas can also be applied to equation questions.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 3 days ago #233597 by holch

Quotas can also be applied to equation questions.


I added it to the manual page.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: tpartner

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose