Welcome to the LimeSurvey Community Forum

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

Undefined variable issue

  • erasmo_purif
  • erasmo_purif's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 10 months ago - 3 years 10 months ago #200881 by erasmo_purif
Undefined variable issue was created by erasmo_purif
Hi,
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:
Code:
!is_empty(Q15_P01)
but I get the error "Undefined variable" on "Q15_P01".

How can I solve that?

Thank you in advance for your help.

Erasmo
Last edit: 3 years 10 months ago by erasmo_purif.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200886 by Joffm
Replied by Joffm on topic Undefined variable issue
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

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: erasmo_purif
The topic has been locked.
  • erasmo_purif
  • erasmo_purif's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 10 months ago #200887 by erasmo_purif
Replied by erasmo_purif on topic Undefined variable issue

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
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose