Welcome to the LimeSurvey Community Forum

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

How to fix 'undefined variables' in LimeSurvey group questions?

  • meljettweb
  • meljettweb's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 3 months ago - 8 years 3 months ago #128982 by meljettweb
I may be over looking something really simple here:
How to fix 'undefined variables' in LimeSurvey group questions?
Steps to reproduce:
installed LimeSurvey Version 2.06+ Build 151109
Imported sample survey: Randomly Ask A Specific Number Of Questions In A Group (a sub-set of the questions) from here: manual.limesurvey.org/Expression_Manager..._of_the_questions.29
  1. Changing question type from 'Short free text' to 'Multiple short text'
  2. Add two sub questions and save
  3. Review survey logic under 'Question Group'
  4. Reveals error 'Undefined Variable'

Some resources reviewed:
Last edit: 8 years 3 months ago by meljettweb. Reason: further clarify question
The topic has been locked.
  • gabrieljenik
  • gabrieljenik's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
8 years 3 months ago #128984 by gabrieljenik
Hmmm is your question still named Q1?

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

Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .

The topic has been locked.
More
8 years 3 months ago #129039 by codelogic
If memory serves you need to change the Q1.relevanceStatus to something like this
Q1.relevanceStatus_1, Q1.relevanceStatus_2
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 3 months ago #129076 by holch
As codelogic says, the problem is the change in question type:

Changing question type from 'Short free text' to 'Multiple short text'


For a short free text question you can access the responses with the question code alone. But if there are various responses in one question, this obviously is not enough, because Limesurvey wouldn't know which of the various responses you are trying to refer to.

So this is not a bug, you just don't access the right information. Have a look at the survey logic file, it should give you the information on how to access it. Probably something like Q1_1. relevanceStatus, etc.

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.
More
8 years 3 months ago #129080 by codelogic

holch wrote: Probably something like Q1_1. relevanceStatus, etc.


holch is right sorry my message wasn't that helpful. Check out the following link for more details.
manual.limesurvey.org/Expression_Manager...on_with_subquestions
The topic has been locked.
More
8 years 3 months ago #129089 by first
I guess this happened to me when I left a space in the question id . Something a login/logout also fix similar issue.

Survey Designer and Programmer
The topic has been locked.
  • meljettweb
  • meljettweb's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 3 months ago - 8 years 3 months ago #129157 by meljettweb
Thanks to everyone's hints, I've got the group randomization working on my survey.
:)
In case anyone needs a visual:

sum(G2Q00002_SQ001.relevanceStatus, G2Q00003_SQ001.relevanceStatus, G2Q00004_SQ001.relevanceStatus, G2Q00005_SQ001.relevanceStatus) LT 1
Last edit: 8 years 3 months ago by meljettweb. Reason: add example
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 3 months ago #129206 by holch
Off topic: Do you really expect to have more than 9999 questions per group or why are you reserving 5 digits for the question per group? ;-)

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.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 3 months ago #129212 by DenisChenu

holch wrote: Off topic: Do you really expect to have more than 9999 questions per group or why are you reserving 5 digits for the question per group? ;-)

If it's a question to meljettweb : i think he used the "automatic" renumber system.

If it's for dev : don't know ;)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 3 months ago #129275 by holch
Question was to meljettweb, but maybe it is actually an automatic setting. In this case it makes more sense to give a little bit of more space...

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.
More
4 years 3 months ago #191949 by Kyler_Hunter
Good Day,

I'm also running into an error. I'm trying to create a specific email. My test structure is:
Code:
{P1Q1}
 - {P1Q1_SQ001.shown}

Now the answer shows just fine, but the actual question I keep getting the "undefined variable" error. If I switch to the sub-question code
Code:
P1Q1_SQ001.question
I do get the sub-question text. Any ideas why the actual question text won't show and I'm getting the "undefined variable" error?

Lime Survey Version : 3.17
Question Type: Array
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 3 months ago #191950 by DenisChenu

Kyler_Hunter wrote: Good Day,

I'm also running into an error. I'm trying to create a specific email. My test structure is:

Code:
{P1Q1}
 - {P1Q1_SQ001.shown}

Now the answer shows just fine, but the actual question I keep getting the "undefined variable" error. If I switch to the sub-question code
Code:
P1Q1_SQ001.question
I do get the sub-question text. Any ideas why the actual question text won't show and I'm getting the "undefined variable" error?

Lime Survey Version : 3.17
Question Type: Array

TOTALLY unrelated to this 3 years old topic : please open a new topic.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose