Welcome to the LimeSurvey Community Forum

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

Equation with if nested problem

More
11 years 9 months ago #115786 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.
More
11 years 9 months ago - 11 years 9 months ago #115799 by tpartner
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: 11 years 9 months ago by tpartner.
The topic has been locked.
More
11 years 9 months ago #115800 by DenisChenu
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 support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
11 years 9 months ago - 11 years 9 months ago #115802 by tpartner

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: 11 years 9 months ago by tpartner.
The topic has been locked.
More
11 years 9 months ago #115804 by DenisChenu

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 support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
Moderators: tpartner, holch

Lime-years ahead

Online-surveys for every purse and purpose