![]() |
||||||||||||
Please take a moment to look at the training schedule and other training options and contact cris@isolutions-inc.com to register for all classes or for more details. --- Tip #1: Delete files using Export Field Contents
In a script
routine where you export or save a file to a location based on a path set in a
variable, you can end up with a lot of documents messing up the user’s
workstation.
Files can
in fact be deleted using the "Export Field Contents" script step. That step is
typically intended to output the contents of a single field from a single
record, such as when you want to retrieve the contents of a container field.
However, if you specify a file path/name for output (either explicitly or by a
variable reference) and DO NOT select a field to export, that file, if it
exists, will be deleted from the user’s workstation. An error code is returned
(102, Field is missing), but you may disregard it.
For example
by adding the following script step after the Send Mail step, you can “clean
up” after yourself by removing the PDF email attachment.
Set
Variable [ $FilePath; Value:Get ( DesktopPath )&"TestFile.pdf”]
Send
Mail [ To: "cris@isolutions-inc.com"; Attachment: “$FilePath” ]
Export Field Contents [“$FilePath”]
The key here is
that when you configure the “Export Field Contents” script step, you will NOT specify a Target field:
Therefore
FileMaker Exports “Nothing” to the same location, using the same filename you
designated in the “$FilePath” variable earlier in the script. No “Replace”
dialog, not appended file name…simply deleting the file you wrote.
This is useful if
you save files of any type (PDF, Excel, FileMaker or any export option) to a
location on the user’s computer in order to perform an action (like using the
file as an attachment for an email). Then when you are done with the action,
you can clean up the user’s computer like it never happened!
DOWNLOAD THE EXAMPLE FILE HERE and try it out yourself! Tip #2: Output an Href for an Image Stored as a Reference in a Container
1. You can extract useful data from a stored Image in a container field by simply defining a new Calculation with only the Container field in the Calculation. for example: If you have a container field called "Image", and you define a Calculation field (resulting as text) called "ImageInfo":
it will result in the following text (on a mac): size:683,558 You can then extract this data to use as an href in the following manner:
Take the Exam: "Developer Essentials for FileMaker 9 "
|
||||||||||||