Welcome to the LimeSurvey Community Forum

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

How to fix 'undefined variables' in LimeSurvey questions/emails?

  • Kyler_Hunter
  • Kyler_Hunter's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 4 months ago - 4 years 4 months ago #191956 by Kyler_Hunter
Good Day,

I'm trying to create a custom email body by using EM . 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 when I place it in another question to check the logic. 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?

LimeSurvey Version : 3.17
Question Type: Array
Last edit: 4 years 4 months ago by Kyler_Hunter.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191958 by tpartner
As far as I know, you cannot access the question text of question types that have sub-questions (array, multiple-text...), you can only access the sub-question text.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191959 by Joffm
Yes, you are right.
P1Q1 is a question with subquestions.

Therefore {P1Q1} is not defined.

Short time ago there was already a discussion that - at the moment - you cannot get the text of the question; only the text of the subquestions.
www.limesurvey.org/forum/design-issues/1...of-multiple-question

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Kyler_Hunter
  • Kyler_Hunter's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 4 months ago #191960 by Kyler_Hunter
Dang, I was hoping I wouldn't have to rewrite the questions completely for the email.

How does the Answer Table pull the text then? Or is that some complicated code in the back end.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191972 by Joffm
That's something different.
There is the table "lime_questions" in the dataset.
If you have access you may have a look.
You see that there is a field "parent_qid", where the reference between question text and subquestion text is established.

But the issue is that this access is mou published in the "access to variables"
manual.limesurvey.org/Expression_Manager...#Access_to_variables

Maybe we will see it in some version in the future.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Kyler_Hunter
  • Kyler_Hunter's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 4 months ago #191976 by Kyler_Hunter
Unfortunately I do not have access to see the back-end. Ah well, cross fingers we will be able to do it in future releases. Thanks!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191985 by DenisChenu

Kyler_Hunter wrote: Unfortunately I do not have access to see the back-end. Ah well, cross fingers we will be able to do it in future releases. Thanks!

It's in 4.0 : github.com/LimeSurvey/LimeSurvey/blob/f8...orAll/config.xml#L12

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 following user(s) said Thank You: tpartner
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #192001 by tpartner
@DenisChenu, nice!

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #192003 by tpartner
To expand on Denis' post, in 4.x you can activate the "expressionQuestionForAll" plugin and then an expression like {Q1.question}, where Q1 is an array, will be valid.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #192012 by DenisChenu

tpartner wrote: @DenisChenu, nice!

You can be insterested by such plugin : github.com/LimeSurvey/LimeSurvey/blob/f8...pleFunctions.php#L12

I hope i found time to allow surveh plugin (expression new function) by twig ;)

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