Newbies aross Posted May 5, 2003 Newbies Posted May 5, 2003 Obviously very new to FM!! I have set up a script to send an email but in using the text body option I can't seem to merge any fields, like Dear <firstname>... is this possible or not an option? How can I do this? Your help is much appreciated! :confused:
cjaeger Posted May 5, 2003 Posted May 5, 2003 1 -create a global field with your mail text. 2 any "merge fields" should be enclosed by "<<" and ">>" 3 now make a calculation field mailtext=substitute(substitute(g_mail_template,"<<firstname>>", firstname),"<<lastname>>",lastname) .... of course, you could simply crate a calc "Dear " & fistname & " " & lastname & " anytexthere..." but that would require a trip to define fields every time you send a new mailing .... instead of changing the global field, you could create a related FM file "templates.fp5" and simply select the appropriate template ...
Newbies aross Posted May 6, 2003 Author Newbies Posted May 6, 2003 Thank you very much, cjaeger. I have set up the first method. I have a challenge... step 3, I have this working: Substitute(Substitute(mailtext, "<<firstname>>", First Name), "<<type>>", invitations::type) how do I add more substituted merge fields? I can't seem to get the function written right. I want to add 2 more: "<<area>>", invitations::area "<<name>>", invitations::content_name how do I put it together in one line? Also, does this mean I have 2 fields on every record with all the text for the email? Will this make the dbase much bigger? Again, many thanks. Al
andygaunt Posted May 6, 2003 Posted May 6, 2003 Hi, If you want to add more fields to your substitution calc, then you would need to do the following Substitute(Substitute(Substitute(Substitute(mailtext, "<<firstname>>", First Name), "<<type>>", invitations::type), "<<area>>, invitations::area),"<<name>>", invitations::content_name) The basic idea is you first have the word substitute, then the field to substitute in and then what you want to substitute. So, when you concatenate in a single field multiple substitutes the substitute( goes first for [x] amount that you require, then the field to substitute in followed closely by what you want to substitute "what to substitute", [field to substitute with) NOW, if anyone can follow this many substitutions AND not have a spelling mistake on them then HTH
Newbies aross Posted May 8, 2003 Author Newbies Posted May 8, 2003 Andy... You are a superstar! "concatenate" - that was the word I was looking for!! Thank you so much, Alan
Newbies aross Posted May 8, 2003 Author Newbies Posted May 8, 2003 IT WORKS!!! Thanks to you both! Al p.s. Andy, it didn't work the first time with a copy and paste... but then with a little playing it did... is it right that the order has to be the order that they appear in the text?
davidchin Posted June 12, 2003 Posted June 12, 2003 Alan, I am also trying to merge fields in the body text. Soo I type the text in the global field with, say, <<Name>>, and the result appears in the calc field, say, "mailtext". Does this mean that I need to identical template layouts for each mail (one to type the letter and the other to view/print/send the substitute fields)? david
Recommended Posts
This topic is 7827 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