Welcome to the LimeSurvey Community Forum

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

Equation with if nested problem

  • stevelegare
  • stevelegare's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
9 years 3 months ago #115786 by stevelegare
Equation with if nested problem was created by stevelegare
I have a IF nested statement like these and I can't show the default email.
Do you know why ?
q5 and q6 are dropdown lists.
{
if(q5 != '1', 'defaultemail',(
if(q6 == '1', 'email1',
if(q6 == '2', 'email2',
if(q6 == '3', 'email3',
if(q6 == '4', 'email4',
if(q6 == '5', 'email5',
if(q6 == '6', 'email6',
if(q6 == '7', 'email7',
if(q6 == '8', 'email8',
if(q6 == '9', 'email9',
if(q6 == '10', 'email10','default@fmed.ulaval.ca'
))))))))))))
}
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago - 9 years 2 months ago #115799 by tpartner
Replied by tpartner on topic Equation with if nested problem
I think you may have an extra set of brackets in there:

Code:
{
if(q5 != '1', 'defaultemail',
if(q6 == '1', 'email1',
if(q6 == '2', 'email2',
if(q6 == '3', 'email3',
if(q6 == '4', 'email4',
if(q6 == '5', 'email5',
if(q6 == '6', 'email6',
if(q6 == '7', 'email7',
if(q6 == '8', 'email8',
if(q6 == '9', 'email9',
if(q6 == '10', 'email10','default@example.com'
)))))))))))
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 2 months ago by tpartner.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #115800 by DenisChenu
Replied by DenisChenu on topic Equation with if nested problem
And { + line feed deactivate EM.
Code:
{if(q5 != '1', 'defaultemail',
if(q6 == '1', 'email1',
if(q6 == '2', 'email2',
if(q6 == '3', 'email3',
if(q6 == '4', 'email4',
if(q6 == '5', 'email5',
if(q6 == '6', 'email6',
if(q6 == '7', 'email7',
if(q6 == '8', 'email8',
if(q6 == '9', 'email9',
if(q6 == '10', 'email10','default@example.com'
)))))))))))}

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.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago - 9 years 2 months ago #115802 by tpartner
Replied by tpartner on topic Equation with if nested problem

And { + line feed deactivate EM.

I think it's best to avoid line-breaks entirely. I just put them in examples for clarity.



.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 2 months ago by tpartner.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #115804 by DenisChenu
Replied by DenisChenu on topic Equation with if nested problem

tpartner wrote:

And { + line feed deactivate EM.

I think it's best to avoid line-breaks entirely. I just put them in examples for clarity.



.

Hi,

In genral i use a lot of line break :)

And more sometimes i use something like this:
Code:
{sum(
...
a lot of line, all ending by ,
....
0)}
Just to allow the last , and the lat line.

;)

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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose