MarijaM Posted May 2, 2005 Posted May 2, 2005 I think this is a really simple thing to do and I hope someone can help. How do I send an email that has in the body the data from one field for all the records in the table? (for example, a list of First names of everyone in the database.) I can get it to send an email that has the field from only one record at a time-- I can't figure out how to get it for all the records (or the records from a found set.) Please help!
Sanjai Posted May 2, 2005 Posted May 2, 2005 Hi, Create a global field which should return text. Write a script: set field(newGlobalField,"") Show all records Go to record [first] loop if trim(firstname] <> "" set field(newGlobalField, newGlobalField & "<Use the new line character>" & firstname) end if go to record [exit after last, next] end loop send mail[] In the send mail script step, select the new global field as the body of the text. --Sanjai
MarijaM Posted May 3, 2005 Author Posted May 3, 2005 Thank you Sanjai, This works perfectly except for one big problem. It generates the email correctly, but then I get a message that Filemaker has generated errors and it shuts down. not good!! Any thoughts?
Sanjai Posted May 3, 2005 Posted May 3, 2005 Hi, Hmm. It would be good to look at your script before giving you a solution. I would suggest not to use the same file again and replace it if you have taken a backup. To debug, in the start of the script, select set error capture[on] and after the send mail script step, enter: if status(currenterror) >0 exit script end if I am not very sure about it because as you said that the email is generated properly. Give me some more details like to help me investigate. --Sanjai
MarijaM Posted May 3, 2005 Author Posted May 3, 2005 Here's the whole script as it is now. It creates the email correctly, but then shuts down filemaker. Set Field [DBname::GlobalField;""] Show All Records Go to Record/Request/Page [First] Loop If [Trim (DBname::Field) <> ""] Set Field [DBname::GlobalField; DBname::GlobalField & "#" & DBName::Field] End If Go to Record/Request/Page [Next; Exit after last] End Loop Send Mail [To: "[email protected]"; Message: DBname:GlobalField] except instead of # it is the paragraph symbol
Sanjai Posted May 3, 2005 Posted May 3, 2005 Hi, Would you like to verify if by mistake instead of using a global field, you are using a text field? I have done it some times where I have created a field starting with "g" and then have forgotten to change the datatype. Otherwise I don't see anything wrong with the script. --Sanjai
MarijaM Posted May 3, 2005 Author Posted May 3, 2005 I did make that mistake at one point, and it caused a problem with the email body only including one record, but I changed it to a global field and the email is working correctly now. However, FileMaker still crashes every time I run it. I even went to the backup and re-wrote the script but it is also crashing the program.
Sanjai Posted May 3, 2005 Posted May 3, 2005 Hi, Could you please try the set error capture[on] script step as I in my previous reply. If you perform the send mail script step without checking the checkbox to "Perform Without Dialog", does the email gets generated? If yes, after that if you send the email manually, FileMaker Pro crashes or simultaneously? --Sanjai
Recommended Posts
This topic is 7136 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