Welcome to the LimeSurvey Community Forum

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

how to write 2 if in one em?

  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 11 months ago #119415 by iscar
how to write 2 if in one em? was created by iscar
{if(a>1,'big','small') if(b>1,'cat','rat')}
i hope this can display "big cat", but it has error in logic file.
what's the problem?
The topic has been locked.
More
8 years 11 months ago #119419 by Ben_V
Replied by Ben_V on topic how to write 2 if in one em?
Code:
{if(a>1,'big','small')} {if(b>1,'cat','rat')}

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 11 months ago #119420 by iscar
Replied by iscar on topic how to write 2 if in one em?
i just don't understand why to use 2 {}?
it's not benefit to write complex EM
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 11 months ago - 8 years 11 months ago #119423 by DenisChenu
Replied by DenisChenu on topic how to write 2 if in one em?
Alternatve:
Code:
{join(if(a>1,'big','small')," ",if(b>1,'cat','rat'))}

Or
Code:
{if(a>1,'big','small')+" "+if(b>1,'cat','rat')}

But i don't like this way.

If in you spreadsheet system you write :
=if(1,"A","B")if(0,"A","B")

It broke too....

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 8 years 11 months ago by DenisChenu.
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 11 months ago #119432 by iscar
Replied by iscar on topic how to write 2 if in one em?
{join(if(a>1,'big','small')," ",if(b>1,'cat','rat'))}
why not use ''?
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose