- Posts: 14
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Nested "if" statements in email notification field
- evinsmj
- Topic Author
- Offline
- New Member
Less
More
6 years 2 weeks ago #166714
by evinsmj
Nested "if" statements in email notification field was created by evinsmj
Hi everyone!
I did some searching on the forum and found a solution for conditionally sending email notifications to an email address based on the answer to a question from within the survey. However, when I try to nest the statements, I can't get it to work. Here's the situation...
I have a question (code: dropdown) that has a list of names. Depending on which name is selected, I need that individual to receive an email notification on submission.
This works: {if(dropdown.code=="A1","email1@test.com","")}
But when I try to nest the if statements for multiple possible recipients, it doesn't work. Here is what I have:
Not only does the recipient for A2 not receive anything, but not even the recipient for A1. Any thoughts as to why the nested statements don't work?
Thanks!
I did some searching on the forum and found a solution for conditionally sending email notifications to an email address based on the answer to a question from within the survey. However, when I try to nest the statements, I can't get it to work. Here's the situation...
I have a question (code: dropdown) that has a list of names. Depending on which name is selected, I need that individual to receive an email notification on submission.
This works: {if(dropdown.code=="A1","email1@test.com","")}
But when I try to nest the if statements for multiple possible recipients, it doesn't work. Here is what I have:
Not only does the recipient for A2 not receive anything, but not even the recipient for A1. Any thoughts as to why the nested statements don't work?
Thanks!
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
6 years 2 weeks ago - 6 years 2 weeks ago #166725
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Nested "if" statements in email notification field
Hi,
your statement is wrong.
{if(condition,true,false)}
And the false-part can be replaced by a new if-statement
So, remove the curly braces in the middle:
Joffm
your statement is wrong.
{if(condition,true,false)}
And the false-part can be replaced by a new if-statement
Code:
{if(condition,true, if(condition,true, if(condition,true, if(condition,true,false) ) ) )}
So, remove the curly braces in the middle:
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 years 2 weeks ago by Joffm.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- evinsmj
- Topic Author
- Offline
- New Member
Less
More
- Posts: 14
- Thank you received: 0
6 years 2 weeks ago #166727
by evinsmj
Replied by evinsmj on topic Nested "if" statements in email notification field
I'm not sure why the curly braces were a problem, but your suggestion definitely fixed the issue. Thank you!!
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
6 years 2 weeks ago #166731
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Nested "if" statements in email notification field
The curly braces are a problem because it indicates a new expression to start (without closing the previous one), which is not what you want to do. It is still the same expression, just with a nested "if" statement.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- evinsmj
- Topic Author
- Offline
- New Member
Less
More
- Posts: 14
- Thank you received: 0
6 years 2 weeks ago #166734
by evinsmj
Replied by evinsmj on topic Nested "if" statements in email notification field
Got it - thanks for the explanation!
The topic has been locked.