Welcome to the LimeSurvey Community Forum

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

Add an answer into an if statement

  • abredevo
  • abredevo's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 2 months ago #239634 by abredevo
Add an answer into an if statement was created by abredevo
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.4.12
Own server or LimeSurvey hosting: LimeSurvey
Survey theme/template: custom
==================
Hi, I have an if statement at the end of my survey to produce a result, it is possible to include an answer from a previous question in the middle of this? I have tested {list(that.Q9.shown)} and it shows the correct answer but I am unsure of how I can build this into my if statement.

Here is an example (which is not working)

{if ((Q4.NAOK == 'Q4D') , '<p><strong>Response:</strong> Based on your responses to questions 4 and 5 you {list(that.Q9.shown)}. In meeting your goals towards {list(that.Q10.shown)} </p>' )}

{list(that.Q9.shown)} and {list(that.Q10.shown)} - these are to bring in the answer chosen for Q9 and Q10. 

I hope this makes sense. Thanks

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 2 months ago #239638 by Joffm
Replied by Joffm on topic Add an answer into an if statement
{if (Q4.NAOK == 'Q4D' , '<p><strong>Response:</strong> Based on your responses to questions 4 and 5 you '+list(that.Q9.shown)+'. In meeting your goals towards '+list(that.Q10.shown)+' </p>' )}

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • abredevo
  • abredevo's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 2 months ago #239639 by abredevo
Replied by abredevo on topic Add an answer into an if statement
Thats brilliant. Thank you so much!

Please Log in to join the conversation.

  • abredevo
  • abredevo's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 2 months ago #239879 by abredevo
Replied by abredevo on topic Add an answer into an if statement
Hi Joffm, on my Q10 I have an 'other' option so the user can write an answer, do you know how I can get '+list(that.Q10.shown)+' to also pull in the text written in the 'other' option?
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 2 months ago - 1 year 2 months ago #239880 by Joffm
Replied by Joffm on topic Add an answer into an if statement
Add it to the "list" function.
"list()" is defined as "list(Q1,Q2,Q3_SQ001,Q3_SQ002,...)
So just add it.
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 2 months ago by Joffm.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose