acro Posted April 28, 2014 Posted April 28, 2014 Iâm trying to set up an Email Script. There are 80 customers in a data base. I have 2 groups to send email to: 6 specific customer names are assigned to âgroup Aâ The other 74 customer names are assigned to âgroup Bâ I want the script to work in the following fashion: When in a record, if the customer name belongs to âgroup Aâ, then the âsent to:â should read âgroup Aâ after the script trigger button is clicked. If the customer name belongs to âgroup Bâ, then the âsent to:â should read âgroup Bâ after the script trigger button is clicked. Question: To achieve this, what would be the syntax to apply on the âEmail Toâ Calculation? See enclosed
Lee Smith Posted April 28, 2014 Posted April 28, 2014 Automatic message This topic has been moved from "FileMaker 13 General Discussion" to "Email".
webko Posted April 28, 2014 Posted April 28, 2014 How is it decided that the Customer belongs to Group A, or Group B? Personally, in the script I'd set a variable for the Group the Customer belongs to, then set the field explicitly after the email is sent... Like: SetVariable[$customerGroup; Value:Content::CustomerGroup] Do email sending etc SetField[Content::SentTo; $customerGroup]
comment Posted April 29, 2014 Posted April 29, 2014 Question: To achieve this, what would be the syntax to apply on the “Email To” Calculation? I am afraid this question makes no sense; the "Send Mail" To calculation needs to calculate the e-mail address of the recipient/s. Neither "group A" nor "group B" are valid e-mail addresses, and if you successfully specify one of them, your mail will not be sent.
acro Posted April 29, 2014 Author Posted April 29, 2014 Ok this is what I'm using and it works for the group of 6 customer you see below: If (Content::Customer= "South Miami Hospital"; "Group A"; "") & If (Content::Customer= "Baptist Hospital of Miami"; "Group A"; "") & If (Content::Customer= "Homestead Hospital"; "Group A"; "") & If (Content::Customer= "Mariners Hospital"; "Group A"; "") & If (Content::Customer= "Doctor's Hospital"; "Group A"; "") & If (Content::Customer= "West Kendall Baptist"; "Group A"; "") the problem is to do the same for the rest of the 76 customers ("Group B") without writing them all out one by one. for example: If (Content::Customer= "Name of customer that is not part of group A, what ever the name might be,<-- don't know how to formulate this syntax"; "Group B"; "") and link the two segments. No worries about how the groups are set up,...just want the script to write either "group A" or "group B", on the mail to (groups are recognized by email app itself) Please let me know your ideas,...Thank you
eos Posted April 29, 2014 Posted April 29, 2014 Ok this is what I'm using and it works for the group of 6 customer you see below: If (Content::Customer= "South Miami Hospital"; "Group A"; "") & If (Content::Customer= "Baptist Hospital of Miami"; "Group A"; "") & If (Content::Customer= "Homestead Hospital"; "Group A"; "") & If (Content::Customer= "Mariners Hospital"; "Group A"; "") & If (Content::Customer= "Doctor's Hospital"; "Group A"; "") & If (Content::Customer= "West Kendall Baptist"; "Group A"; "") Since being in a group obviously is an attribute of a customer, the easiest solution is to add a field to the Customer table, assign the respective value ("Group A" or "Group B") to each record, then simply read from that field, i.e. use the expression Content::group. As for the way to code these calculations: you would use OR instead of chaining multiple If()s … Let ( c = Content::Customer ; Case ( c = "South Miami Hospital" or c = "Baptist Hospital of Miami" or c= "Homestead Hospital" or c = "Mariners Hospital" or c = "Doctor's Hospital" or c = "West Kendall Baptist"; "Group A" ; c = "..." or etc. ; "Group B" ) ) … or 'simpler' and less cluttered, test for list membership … Let ( [ c = Content::Customer ; aList = List ( "South Miami Hospital" ; "Baptist Hospital of Miami" ; "Homestead Hospital" ; "Mariners Hospital" ; "Doctor's Hospital" ; "West Kendall Baptist" ) ; bList = List ( manyNames . . . ) ] ; Case ( not IsEmpty ( FilterValues ( aList ; c ) ) ; "Group A" ; not IsEmpty ( FilterValues ( bList ; c ) ) ; "Group B" ) ) … but while all this is syntactically correct, it's not the right approach.
acro Posted April 29, 2014 Author Posted April 29, 2014 "Since being in a group obviously is an attribute of a customer, the easiest solution is to add a field to the Customer table, assign the respective value ("Group A" or "Group B") to each record, then simply read from that field, i.e. use the expression Content::group." Yeap,...that resolved it, simple an easy! Thank you so much, eos and all that reply!
Recommended Posts
This topic is 3852 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now