May 2, 200520 yr 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!
May 2, 200520 yr 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
May 3, 200520 yr Author 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?
May 3, 200520 yr 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
May 3, 200520 yr Author 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
May 3, 200520 yr 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
May 3, 200520 yr Author 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.
May 3, 200520 yr 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
Create an account or sign in to comment