Use Scripts to Chain or Control Operations¶
Instead of using operation actions, a controller script uses the
RunOperation function to link operations together using a script.
To capture a failed operation, the
If function can be used in conjunction with
RunOperation. For example:
If(!RunOperation(<operation tag>),<condition>), where the condition can use
GetLastError to capture the error, and can elect to stop the entire process using
RaiseError, and/or run another process to accumulate error text.
A controller script can be beneficial in situations such as these:
- To run an operation that is dependent on external factors such as project variables or data.
- To call sub-operations from within a loop, where data is passed to the operation from a list.
- To trace operation chain activities. For example:
(WriteToOperationLog("count of records to process: " + cnt),
WriteToOperationLog("Starting update operation at: " + Now()),
WriteToOperationLog("Database query: " + sql), etc.)
Other Uses of Scripts¶
Other areas where scripting is frequently used are within the mapped fields in transformations and in other stand-alone scripts. If the same script is being used within more than one transformation, consider setting up that script as a stand-alone script and calling it from within each transformation using