May 5, 200322 yr Newbies 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:
May 5, 200322 yr 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 ...
May 6, 200322 yr Author Newbies 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
May 6, 200322 yr 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
May 8, 200322 yr Author Newbies Andy... You are a superstar! "concatenate" - that was the word I was looking for!! Thank you so much, Alan
May 8, 200322 yr Author Newbies 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?
June 12, 200322 yr 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
Create an account or sign in to comment