Welcome to the LimeSurvey Community Forum

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

Changed successfully an error text; is there a technically "cleaner" way...?

  • lsurvey20
  • lsurvey20's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago - 3 years 2 months ago #212174 by lsurvey20
Hi,
in a suryvey I have a larg amount of pictures, where the user should select exactly 9 pictures, and later on sort his favourite three. This all works fine. But as the error message, I needed something different, which I achived by changing the "Question validation equation" to
Code:
count(self.NAOK) == 9
and the "Question validation tip" to
Code:
{if(count(self.NAOK)<9,"You have chosen ")}{if(count(self.NAOK)<9,count(self.NAOK))}
{if(count(self.NAOK)<9," of 9 required pictures!")}
{if(count(self.NAOK)==9,"Many thanks for selecting the pictures. You can continue at the bottom of this page!")}
{if(count(self.NAOK)>9,"You selected too many (")}{if(count(self.NAOK)>9,count(self.NAOK))}
{if(count(self.NAOK)>9," of 9) pictures.<br>Please deselect be klicking on the pictures!")}

which works as expected. But having a small experiemce in programming, I personally would have liked to use "if/then/else" statements or a way to have the displayed text and the count(self.NOAK) evaluation in _one_ statement for better readability. Don't get me wrong: I am "pleased as a Punch" as a newbie in LimeSurvey wich I am, and many thanks for enabling this way. I just wanted to ask for a "cleaner" way - if possible - so that I stay on track. LimeSurvey version 3.25.5 used.

many thanks in advance
Juergen
 
Last edit: 3 years 2 months ago by lsurvey20.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago - 3 years 2 months ago #212179 by Joffm
Hi, Juergen,
quick answer:
The IF-Statement works as in EXCEL:
[url] manual.limesurvey.org/ExpressionScript_-...mplemented_functions [/url]ifExcel-style

{IF(condition, What if TRUE, Else What if FALSE)}

And you may nest it like this :
{IF(age<18,1,if(age<50,2,3))}
Or more:
{IF(age<18,1,if(age<30,2,if(age<40,3,if(age<50,4,if(age<60,5,6)))))}

And to insert an equation into your text
{IF(age<18,"You told us your are " + age + " years old. You are too young","You  have " + count(QX) + "apples")}

And your validation tip could be like this:
{if(count(self.NAOK)<9,"You have chosen " + count(self.NAOK) + " of 9 required pictures!", if(count(self.NAOK)==9,"Many thanks for selecting the pictures. You can continue at the bottom of this page!","You selected too many (" + count(self.NAOK) + " of 9) pictures.<br>Please deselect be klicking on the pictures!"))}


This IF function works without the FALSE part.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 2 months ago by Joffm.
The following user(s) said Thank You: lsurvey20
The topic has been locked.
More
3 years 1 month ago #212712 by JohnPS
Hi, I am trying to find how I can change the wording of the 'error / time out message' as the email it ties to is the survey email inbox which is not monitored and I want to change that email address to our help desk.

If anyone knows where this message is formated can you advise please.
Thanks
John
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose