- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Undefined variable issue
- erasmo_purif
-
Topic Author
- Offline
- New Member
-
I'm using LimeSurvey Version 3.22.17.
I created a non-mandatory question (Code: Q15) with Question Type: Array (Texts).
Subquestions are coded: P01, P02, P03.
I want to make only subquestion P01 mandatory and, following other threads in the forum, I added in "Logic -> Subquestion validation equation" the following expression:
!is_empty(Q15_P01)
How can I solve that?
Thank you in advance for your help.
Erasmo
!is_empty(Q15_P01) This is wrong syntax.
If you use an array(text) you have two subquestion scales (y-scale and x-scale)
So the QCode contains both to select a certain cell, like
!is(empty(Q1_Y001_X004)
Your idea of "subquestion validation" would succeed with "!is_empty(this)"
BUT: It checks ALL subquestions.
Like the example in the sample survey
For example, if you want to allow only numbers that are a multiple of 3 as answers, the equation would be:
(this / 3) == floor(this/3)
To validate only this subquestion you have to check all cells of that row in "question validation"
!is(empty(Q15_P01_X001) and !is(empty(Q15_P01_X002) and !is(empty(Q15_P01_X003) and ...
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
- erasmo_purif
-
Topic Author
- Offline
- New Member
-
- Posts: 2
- Thank you received: 0
Joffm wrote: Hi
!is_empty(Q15_P01) This is wrong syntax.
If you use an array(text) you have two subquestion scales (y-scale and x-scale)
So the QCode contains both to select a certain cell, like
!is(empty(Q1_Y001_X004)
Your idea of "subquestion validation" would succeed with "!is_empty(this)"
BUT: It checks ALL subquestions.
Like the example in the sample survey
For example, if you want to allow only numbers that are a multiple of 3 as answers, the equation would be:
(this / 3) == floor(this/3)
To validate only this subquestion you have to check all cells of that row in "question validation"
!is(empty(Q15_P01_X001) and !is(empty(Q15_P01_X002) and !is(empty(Q15_P01_X003) and ...
Joffm
Dear Joffm,
thank you very much for your response. I was completely ignoring the second axis!
Regards,
Erasmo