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?

More
4 years 8 months ago #187038 by chuchocosta
the solution works ok, thank you so much. I have version 3.17.4
The topic has been locked.
More
4 years 3 months ago - 4 years 3 months ago #191915 by Kyler_Hunter
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:
Code:
{if(P1Q1_SQ001.code=="[A1]", "someone@somewhere.com", "")else if(P1Q1_SQ001.code=="[A2]", "someone@somewhere.com", "")}
But it doesn't send the email. Did I write this wrong somehow?
I'm on version 3.17
Last edit: 4 years 3 months ago by Kyler_Hunter.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 3 months ago #191916 by tpartner
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:

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.
More
4 years 3 months ago #191919 by Kyler_Hunter
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
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
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.
The topic has been locked.
More
4 years 3 months ago - 4 years 3 months ago #191964 by Kyler_Hunter
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:
Code:
{if(intval(P1Q1_SQ001) <= 8, if (P1Q2_SQ001) <= 8, if(P1Q3_SQ001) <= 8, "someone@somewhere.com", ""))))}
and
Code:
{if(intval(P1Q1_SQ001) <= 8, "someone@somewhere.com", "")}{if(intval(P1Q2_SQ001) <= 8, "someone@somewhere.com", "")}{if(intval(P1Q3_SQ001) <= 8, "someone@somewhere.com", "")}
Is there a way to write this so the email gets sent if any combination occurs?
Last edit: 4 years 3 months ago by Kyler_Hunter.
The topic has been locked.
More
4 years 2 months ago #192726 by kate92
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.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #192728 by tpartner
So, you want to send the email if anything is entered in P11?

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.
More
4 years 2 months ago #192730 by kate92

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
  • Joffm's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #192732 by Joffm
Hi,
you really don't have this?




Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
4 years 2 months ago - 4 years 2 months ago #192798 by kate92

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?
Last edit: 4 years 2 months ago by kate92. Reason: double screenshot
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose