Welcome to the LimeSurvey Community Forum

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

Conditionals in the end message

  • ordogz
  • ordogz's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 2 months ago - 7 years 2 months ago #148550 by ordogz
Conditionals in the end message was created by ordogz
Hello,

I'm trying to use the approach below, for my survey:
{if(howmany == 1, price1.question,'')}
{if(howmany == 2, price2.question,'')}
{if(howmany == 3, price3.question,'')}
{if(howmany == 4, price4.question,'')}
{if(howmany == 5, price5.question,'')}

But, for some unknown reason( of course for me ...), it works only for one report(ICReport...see in the lss attached file, in the end message of the survey)

File Attachment:

File Name: limesurvey...2-10.lss
File Size:91 KB

For the other two ( DSReport and ECReport) it's not showing anything in the end message, even if I'm using the same conditionals just with different answers.
Please help me in my endeavor to make this functional.
Thank you!
Last edit: 7 years 2 months ago by ordogz.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago - 7 years 2 months ago #148557 by tpartner
Replied by tpartner on topic Conditionals in the end message
It seems that in "DemScore" and "ECScore", you have a space after the equations so your IF statements can never be true because they don't include that space.

Remove all spaces from the equation questions or, even better, remove it with the trim function in your IF statements.

Code:
{if(trim(DemScore) == 1, DSReport1.question,'')}
{if(trim(DemScore) == 2, DSReport2.question,'')}
{if(trim(DemScore) == 3, DSReport3.question,'')}
{if(trim(DemScore) == 4, DSReport4.question,'')}
{if(trim(DemScore) == 5, DSReport5.question,'')}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 2 months ago by tpartner.
The following user(s) said Thank You: holch
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 months ago #148567 by holch
Replied by holch on topic Conditionals in the end message
Great catch, Tpartner. I was looking for any problems, but I couldn't find anything. I did not think of spaces though.

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.

Lime-years ahead

Online-surveys for every purse and purpose