how î can do this with an button export
The Save as PDF script step has an option to open an email with the PDF as an attachment.
Set Field [YourTable::ContainerFieldHere ; GetLayoutObjectAttribute ( "ChartObjectnameHere" ; "Content" ) ]
Set Variable [$Path ; Get ( TemporaryPath ) & "ChartImage.png" )
Export Field Contents [ YourTable::ContainerFieldHere ; $Path ]
Send Mail [ ] ----> Use $Path to specify this image file as an attachment
i can that without create container field in my table
Because i donot need stored this container field to database
I have lots of charts this just example
If you want to store an attachment to send it via email, then you need to store it somewhere.
To add on to the above script, when you are done sending the mail, just clear the container using:
Set Field [YourTable::ContainerFieldHere ; "" ]
This is what global fields are used for.
You only need one container field. You can use the same field for every chart image. It can even be a global field. But you do need that field somewhere in order to produce the needed file and attach it.
I am able to successfully export the chart to a container. I am using an external, open container field (so I can display the images from the web server). It appears to create 2 files. Untitled.jpg and Untitled.png. Is there a way to tell it to just create one of these? Is it possible to name the file by calculation?
Any suggestions would be appreciated.
As I understand the process, the additional file is a thumbnail of the chart image.
Ahh. That makes sense. Any way to name the file when it's saved in the container?
You can name the file by exporting from the container. So you can export field contents to the temporary folder, specifying the name that you want, then re-insert it back into the original container if you want to store a copy in that way.
After getting this to work on FMPA16, I found this line in the GetLayoutObjectAttribute ["Chart_Graphic"; "Container"] Logical Function.
"In FileMaker WebDirect, when this function acts on a web viewer or a chart, the content and source attributes return an empty string."
Is there any way to programmatically export a chart to a graphic container or file on the server in WebDirect?
There's no simple way to do that with just FileMaker native functions. You could, in theory at least, create a record in a special table that identifies the records to be used to create the chart. A robot file running on a FileMaker client could make period checks for new records in such a table and then produce the needed chart image in the resulting client session.
The other option might be to generate a PDF of a layout on which the chart object is located. Doesn't 16 offer new options for PDF's from WebDirect clients?
Thank you. I just had a thought. Would there be a way to execute this on the server (Perform Script on Server) to save the chart to a container?
Go To Layout [Chart_Layout]
[Find specific chart]
$$Temp_Chart_Graphic = GetLayoutObjectAttribute ["Chart_Graphic"; "Content"]
Go To Layout [Export_Chart_Graphic]
Set Field [Chart_Graphic_Container; $$Temp_Chart_Graphic]
What do you think?
That part of the script is server compatible, so it should work. Exporting field contents and inserting into container fields is not server compatible so that part of the process described here would not work server side.
Thanks. Sorry for being dense. My only end goal is to be able to save the chart as a graphic in a container (external, open). Then I can get to the graphic files in the file structure of the server to view them (through an IIS virtual directory). I don't need to export it after that.
Are you saying that the "Set Field [Chart_Graphic_Container; $$Temp_Chart_Graphic]" script step would not work on the server?
Earlier in the thread, I described how to rename the file created by this method. It requires export field contents and Insert File or Insert Picture. These steps are not server compatible at least they were the last time that I checked.
You can check scripts for basic server compatibility in the scripts works space.
Retrieving data ...