- Posts: 1
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Can I send email conditionally, based on a question response?
- chuchocosta
- Offline
- New Member
Less
More
4 years 8 months ago #187038
by chuchocosta
Replied by chuchocosta on topic Can I send email conditionally, based on a question response?
the solution works ok, thank you so much. I have version 3.17.4
The topic has been locked.
- Kyler_Hunter
- Offline
- New Member
Less
More
- Posts: 14
- Thank you received: 0
4 years 3 months ago - 4 years 3 months ago #191915
by Kyler_Hunter
Replied by Kyler_Hunter on topic Can I send email conditionally, based on a question response?
Dotxm,
I've been trying to use your code on an Array question (1-10 radio choice). However I've not been able to get it to work plus I need it to be for various answers (basically if anyone answers 8 or lower). I've tried the following:
But it doesn't send the email. Did I write this wrong somehow?
I'm on version 3.17
I've been trying to use your code on an Array question (1-10 radio choice). However I've not been able to get it to work plus I need it to be for various answers (basically if anyone answers 8 or lower). I've tried the following:
Code:
{if(P1Q1_SQ001.code=="[A1]", "someone@somewhere.com", "")else if(P1Q1_SQ001.code=="[A2]", "someone@somewhere.com", "")}
I'm on version 3.17
Last edit: 4 years 3 months ago by Kyler_Hunter.
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10633
- Thank you received: 3697
4 years 3 months ago #191916
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Can I send email conditionally, based on a question response?
There is no "else if" in Expression Manager, it uses nested IFs like Excel -
manual.limesurvey.org/Expression_Manager_-_presentation#Syntax
Also, there are no square braces required in Expression manager.
That said, if you change the answer code to numerics 1-10, you could do something like this:
Also, there are no square braces required in Expression manager.
That said, if you change the answer code to numerics 1-10, you could do something like this:
Code:
{if(intval(P1Q1_SQ001) <= 8, "someone@somewhere.com", "")}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Kyler_Hunter
The topic has been locked.
- Kyler_Hunter
- Offline
- New Member
Less
More
- Posts: 14
- Thank you received: 0
4 years 3 months ago #191919
by Kyler_Hunter
Replied by Kyler_Hunter on topic Can I send email conditionally, based on a question response?
Dude you are awesome! It worked!
On a slight side note the generated answer table ...well it sucks. To much info and the formatting is terrible. Is there a way to use Expression Manager to pull the Questions , sub-question and answers and format them the way I want and not have to go into the actual PHP code (we're not suppose to but I don't want to say no we cannot)?
Example :
"Question:
- Sub-Question: Answer"
Thanks
On a slight side note the generated answer table ...well it sucks. To much info and the formatting is terrible. Is there a way to use Expression Manager to pull the Questions , sub-question and answers and format them the way I want and not have to go into the actual PHP code (we're not suppose to but I don't want to say no we cannot)?
Example :
"Question:
- Sub-Question: Answer"
Thanks
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10633
- Thank you received: 3697
4 years 3 months ago #191921
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Can I send email conditionally, based on a question response?
Yes, of course you can develop your own answers table/layout with Expression Manager.
- manual.limesurvey.org/Expression_Manager...n#Tailoring.2FPiping
- manual.limesurvey.org/Expression_Manager...swers.2C_and_Reports
- manual.limesurvey.org/Expression_Manager...red_on_the_same_page
- manual.limesurvey.org/Expression_Manager...n#Tailoring.2FPiping
- manual.limesurvey.org/Expression_Manager...swers.2C_and_Reports
- manual.limesurvey.org/Expression_Manager...red_on_the_same_page
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Kyler_Hunter
- Offline
- New Member
Less
More
- Posts: 14
- Thank you received: 0
4 years 3 months ago - 4 years 3 months ago #191964
by Kyler_Hunter
Replied by Kyler_Hunter on topic Can I send email conditionally, based on a question response?
tpartner,
I love clients. New requirement is that any of the rating question now if answered 8 or lower send an email. I've tried various combinations of the code you gave me and as long as only one of the question is 8 or below we get the email, but if all ratings are 8 or below no email shows up.
I've tried the following:
and
Is there a way to write this so the email gets sent if any combination occurs?
I love clients. New requirement is that any of the rating question now if answered 8 or lower send an email. I've tried various combinations of the code you gave me and as long as only one of the question is 8 or below we get the email, but if all ratings are 8 or below no email shows up.
I've tried the following:
Code:
{if(intval(P1Q1_SQ001) <= 8, if (P1Q2_SQ001) <= 8, if(P1Q3_SQ001) <= 8, "someone@somewhere.com", ""))))}
Last edit: 4 years 3 months ago by Kyler_Hunter.
The topic has been locked.
- kate92
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
4 years 2 months ago #192726
by kate92
Replied by kate92 on topic Can I send email conditionally, based on a question response?
I have similar problem. I'm trying to send detailed admin mail but based on an answer to a specific question. The problem is, the answer is short text, situation description.
How should I change this:
{if(QUESTIONCODE.code=="ANSWERCODE","EMAIL","")}.
My questioncode is P11, question tipe is short text (Describe situation). And the answer is situation description.
How should I change this:
{if(QUESTIONCODE.code=="ANSWERCODE","EMAIL","")}.
My questioncode is P11, question tipe is short text (Describe situation). And the answer is situation description.
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10633
- Thank you received: 3697
4 years 2 months ago #192728
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Can I send email conditionally, based on a question response?
So, you want to send the email if anything is entered in P11?
In that case:
In that case:
Code:
{if(!is_empty(P11), "EMAIL", "")}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- kate92
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
4 years 2 months ago #192730
by kate92
Yes. I'll try that tomorrow. I would also like to add a coleage as admin for this survey but I have some odl versin 2.67.1+sometnig and don't have configation tab, so...
Thank you very much for the help!!!
Replied by kate92 on topic Can I send email conditionally, based on a question response?
tpartner wrote: So, you want to send the email if anything is entered in P11?
In that case:
Code:{if(!is_empty(P11), "EMAIL", "")}
Yes. I'll try that tomorrow. I would also like to add a coleage as admin for this survey but I have some odl versin 2.67.1+sometnig and don't have configation tab, so...
Thank you very much for the help!!!
The topic has been locked.
- Joffm
- Online
- LimeSurvey Community Team
Less
More
- Posts: 12788
- Thank you received: 3940
4 years 2 months ago #192732
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Can I send email conditionally, based on a question response?
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.
- kate92
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
4 years 2 months ago - 4 years 2 months ago #192798
by kate92
I do have that.
I don't have this:
And when I go to the Survey permission and want to add a user, it dosen't allow me. It says, "please choose a user". And when I want to choose, there aren't any! What am I doing wrong?!
My survey doesn't use TOKEN. It uses name and password from a third app.
The sugestion with IF statement did't work. Maybe I should put semicolon like I do in excel?
Replied by kate92 on topic Can I send email conditionally, based on a question response?
Joffm wrote: Hi,
you really don't have this?
Joffm
I do have that.
I don't have this:
And when I go to the Survey permission and want to add a user, it dosen't allow me. It says, "please choose a user". And when I want to choose, there aren't any! What am I doing wrong?!
My survey doesn't use TOKEN. It uses name and password from a third app.
The sugestion with IF statement did't work. Maybe I should put semicolon like I do in excel?
Attachments:
Last edit: 4 years 2 months ago by kate92. Reason: double screenshot
The topic has been locked.