Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5540 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi, I am trying to script sending emails with an academic report attachment to our parents.

Specifically, I need to generate an email to each of my 9th grade students' parents (79 students). I would like to add their current midterm report as the attachment.

The midterm pdf currently sits in a container field in the student table.

I've read on the FMP site "Variables are not supported in file paths that are stored in container fields".

Any ideas for a work around?

Cheers

Posted

"The midterm pdf currently sits in a container field in the student table."

Hmm., that doesn't seem like the best structure. I would imagine that a student can have multiple reports, and so you really ought to have a Documents table related to the Student Table by Student ID.

Are the reports generated from this system? If so, the report can be generated and emailed in one script.

But, the basic structure of the script given your current setup would be to loop thru the found student records, export the container to a $path, and then Send Mail, specifying the $path as the Attachment. I'll do a simple demo after you answer whether the reports can be generated on the fly and if you agree that they belong in a child table.

Posted

Yes, the structure could and should be improved, but I'm under a bit of a time crunch. So yes, a separate table is a good idea.

I'd love to see an example based on what you referenced.

Thanks

Posted (edited)

Here it is. Remember it sends an email, so change the student's email to yours in order to test.

This demo assumes that the PDF is embedded in the container, as opposed to stored as a reference.

EmailLoopContainer.fp7.zip

Edited by Guest
Posted (edited)

Thanks so much. This seems like it should work. However, I'm now getting this message:

"" could not be created on this disk. Use a different name, make more room on the disk, unlock it or use a different disk.

Is this something to do with the container field data being stored in Filemaker or stored as reference? One more thing I don't quite fully understand.

Thanks

Sorry, just re-read your post. I think I actually am storing the pdf in the database and not a reference, but exactly how would I know?

Edited by Guest
Posted (edited)

How does the pdf get in the container? Notice, there's a checkbox at the bottom of the Insert File dialog. That is the key.

Using Data Viewer, you can evaluate the container field. If it shows two paths, then it's a reference. Just the filename, and it is embedded.

Edit: Do you get the error message running my demo or in your system?

Edited by Guest
Posted

Nope, it was me. I left out part of the design. I was running the send mail script in the manager part of this DB, basically a shell but no actual data. The data resides in a 'databank' DB on the server.

As soon as I moved the send mail script over to the "real" database, it worked perfectly. I now understand the file reference thing much better, I believe I was over thinking it.

I also took your advice about the related documents table for storing the pdf reports.

Thanks again for all of your help.

Posted

OK, so what you have is a setup referred to as the "Separation Model," if that helps when you attempt to modify the system.

This topic is 5540 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.