Welcome to the LimeSurvey Community Forum

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

Equation

  • MDB_ClientSurvey
  • MDB_ClientSurvey's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 1 week ago #267886 by MDB_ClientSurvey
Equation was created by MDB_ClientSurvey
I need to dynamically update the country name of the respondent

I have predefined country, which is stored in Attribute 1
In question SCR1 I want the respondent to confirm the country (1 Yes, 2 No). When they say no, not a correct country
I have SCR2 which is a drop down, and from there respondent selects the right country.

Afterwards, i need to use the country name for the next questions.

I tried to add a new question hiddenCountry with this {if(SCR1.NAOK == "1", TOKEN:ATTRIBUTE_1, SCR2.NAOK)}, and then in Q1 question text add {hiddenCountry}, but my next question shows the code, not the country name. I have also tried to put the code inside Q1 question, no results again, it just shows the code as a text

How should i solve it?


 

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 1 week ago #267888 by holch
Replied by holch on topic Equation
With {hiddenCountry} you tell LS to show the answer code, which is obviously does.

You need to use the right code, which probably is {hiddenCountry.shown}.

Read the manual about expression manager:

www.limesurvey.org/manual/Expression_Manager

You'll find this:
www.limesurvey.org/manual/Expression_Man...benefits_of_using_EM ?

New Variable Attributes - you can access the following to do your tailoring:
(no suffix) - an alias for qcode.code
.code - the selected response code for the question if it is relevant (otherwise blank), or the text value if it is not a coded question
.NAOK - same as .code, but can be part of calculations or lists even if irrelevant
.value - the assessment value for the question if it is relevant (otherwise blank), or the text value if it is not a coded question -- available is assesments are enabled for the survey, otherwise always zero
.valueNAOK - same as .value, but can be part of calculations or lists even if irrelevant
.shown - the answer as displayed to the user (this is what {INSERTANS:xxx} does)
.qid - the question ID
.gid - the group ID
.sgqa - the SGQA value for the question
.jsName - the correct javascript variable name for the question, regardless whether defined on this page or another
.qseq - the question sequence (starting from 0)
.gseq - the group sequence (starting from 0)
.mandatory - whether the question is mandatory (Y/N)
.question - the text of the question
.relevance - the relevance equation for the question
.grelevance - the relevance equation for the group
.relevanceStatus - whether or not the question is currently relevant (boolean (can be different in PHP and JS))
.type - the question type (the one character code)


But I really recommend to read through this. Might take 30min, but it really helps to better understand Expression Manager.

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

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose