Welcome to the LimeSurvey Community Forum

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

Syntax for if-statements: Is there a way to use a vector in if-statements

  • DVP17lemon
  • DVP17lemon's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 3 days ago #169201 by DVP17lemon
Hello, I am using a conjoint experiment with placeholders, that should print a yes/no if they match a variable that was assigned to 256 random combinations.


Now a segment of the placeholder looks like this:

{if(RANDOM == 3 or RANDOM == 4 or RANDOM == 7 or RANDOM == 8 or RANDOM == 11 or RANDOM == 12 or RANDOM == 15 or RANDOM == 16 or RANDOM == 19 or RANDOM == 20 or RANDOM == 23 or RANDOM == 24 or RANDOM == 27 or RANDOM == 28 or RANDOM == 31 or RANDOM == 32 or RANDOM == 35 or RANDOM == 36 or RANDOM == 39 or RANDOM == 40 or RANDOM == 43 or RANDOM == 44, 'Yes', 'No')}

Is there a way to use a vector like this:

if(RANDOM == (3,4,7,8), 'Yes', 'No') ?

Or a different operator like "in"?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 day ago #169226 by tpartner
No, that is not available in Expression Manager.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
7 years 1 day ago #169232 by orvil
Just another problem where an extendable EM could help!
Solved a similar problem by doing so - but have to maintain and re-edit em_core_helper.php after every update :(

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 day ago #169241 by holch
Tried to push it to the core?

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose