Equation with if nested problem

More
2 years 10 months ago #115786 by stevelegare
stevelegare created the topic: Equation with if nested problem
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','This email address is being protected from spambots. You need JavaScript enabled to view it.'
))))))))))))
}

Please Log in to join the conversation.

More
2 years 10 months ago - 2 years 10 months ago #115799 by tpartner
tpartner replied the topic: Equation with if nested problem
I think you may have an extra set of brackets in there:

{
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: 2 years 10 months ago by tpartner.

Please Log in to join the conversation.

More
2 years 10 months ago #115800 by DenisChenu
DenisChenu replied the topic: Equation with if nested problem
And { + line feed deactivate EM.
{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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
2 years 10 months ago - 2 years 10 months ago #115802 by tpartner
tpartner replied the 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: 2 years 10 months ago by tpartner.

Please Log in to join the conversation.

More
2 years 10 months ago #115804 by DenisChenu
DenisChenu replied the 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:
{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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!