The ability to run a TCL script before or after an FME translation was available in FME 2006 GB. For FME 2007, Python scripting ability has been added and these scripts are exposed as settings in the Workspace Settings dialog.
Potential uses of such scripts are:
• To check a database connection before running the translation.
• To move data prior to or after the translation
• To write the translation results to a custom log or e-mail them to an administrator
For more information, see FME_BEGIN_PYTHON and FME_END_PYTHON in the FME Fundamentals manual. For examples, see fmepedia.
This setting allows a Python script file to execute just prior to the start of translation. The script is executed after the mapping file has been completely parsed, and after the logfile has been opened, but before any of the readers or writers have begun to do their processing.
Note: FME will abort the translation if the execution of FME_BEGIN_PYTHON scripts fails. If, for some reason, this behavior is undesirable and you want to continue a translation even if the execution fails, you can use Python's exception handling to trap errors, allowing FME to continue with the translation.
This setting allows a Python script file to execute just after translation has completed, either successfully or prematurely due to an error being encountered.
If the translation ended due to an error, the script is executed after all cleanup is done, all reader and writers are shut down, and the logfile has been closed. If the translation was successful, the script is executed after all the the readers and writers have finished their work, and the logfile has been closed.
The script has access to a number of Python global variables that contain statistics and other information about the translation.