User Guide > Scripting > Script Objects > Transformation Object
Was this helpful?
Transformation Object
During the transformation process, the transformation engine has access to the run-time configuration as well as engine statistics that may be applicable to the map. These are available through the Transformation object and can be used in mapping expressions or in ECA rule conditions.
Example
You might use a mapping expression like the following to generate a column in a reject target that relates the rejected record to the original source record. The following expressions return:
the number of records read from a named input:
Transformation.RecordCount("SOURCE_1")
the number of records records written to a named output:
Transformation.RecordCount("TARGET_1")
the name of the transformation map:
Transformation.MapName
the transformation state of the map:
Transformation.TransformationState
The Transformation object supports the following read-only properties.
Property
Type
Description
CurrentSourceName
String
Name of active source
CurrentTargetName
String
Name of the target, based on the context of the action.
When the action is executed during the evaluation of ECA rules on a control link, the name is the name of the target referenced by the target side of the control link. In cases where the action is executed outside of a control link, the property returns an empty string.
EventParameterString
String
Parameter string for the last event. Used primarily for handling user-defined events.
IterationCount
Integer
Number of iterations specified for the current OutputRecord action.
IterationNumber
Integer
Current iteration number while processing an OutputRecord action IterationNumber >= 1 and IterationNumber <= IterationCount.
LastAbortReasonCode
Integer
Returns the reason code specified in the Abort action of the current source record. If you do not set a reason code, the default is 1.
LastErrorCode([target_port_name])
Integer
Error code from the last OutputRecord or ExecuteCommand action on the current target, or on an optionally specified target.
If you do not specify a target, the current target is used.
LastErrorMessage([target_port_name])
String
Error message from the last OutputRecord or ExecuteCommand action on the current target, or on an optionally specified target.
If you do not specify a target, the current target is used.
LastRecordAddress([source_port_name])
String
Record address for the last source record from the current source, or on an optionally specified source.
If you do not specify a source, the current source is used.
LastRecordState([source_port_name])
Integer
State for the last source record from the current source, or on an optionally specified source. State values are:
1 (active)
2 (discarded)
3 (rejected)
If you do not specify a source, the current source is used.
LastRecordType([source_port_name])
String
Record type for the last source record from the current source, or on an optionally specified source.
If you do not specify a source, the current source is used
LastRejectReasonCode
Integer
Returns the reason code specified in the Reject action of the current source record.
If you do not set a reason code, the default is 1.
LastScriptingErrorCode
Integer
Numeric code for the last scripting error
LastScriptingErrorMessage
String
Message text for the last scripting error
MapName
String
Name of the transformation map
RecordCount([input_or_output_name])
Integer
Number of records read from a named input, or the number of records written to a named output.
Intermediate targets (i.e. temporary targets, lookups) are both sources and targets. If you specify the name of an intermediate target, you will get the number of records written (it will be treated as a target). To specify which you actually want (source/read count, or target/write count), you may append "_t" or "_s" to the port name.
TargetRecordAddress([target_port_name])
String
Record address for the current or named target. This property is only active while a control link is being processed, and its value is the target record address pointed to by the control link. If no control link is currently active, the value is empty.
In general, this property would be called with no target_name parameter. It is possible that more than one control link is active (if a control link performs an OutputRecordSet), in which case specifying the target_name is useful.
TotalErrorCount
Integer
Total number of transformation errors counted
TotalRecordsDiscarded([source_port_name])
Integer
Total number of records discarded from all sources for the transformation process, or total number of records discarded from a specific source.
If you do not specify a source, the current source is used.
TotalRecordsRead([source_port_name])
Integer
Total number of records read from all sources for the transformation process, or total number of records read from a specific source.
If you do not specify a source, the current source is used.
TotalRecordsRejected([source_port_name])
Integer
Total number of records rejected from all sources for the transformation process, or total number of records rejected from a specific source.
If you do not specify a source, the current source is used.
TotalRecordsWritten([target_port_name])
Integer
Total number of records written to all targets for the transformation process, or total number of records written to a specific target.
If you do not specify a target, the current target is used.
TransformationState
Integer
Transformation state values are as follows:
1 (initializing/active)
2 (running)
3 (terminated)
4 (stopped)
Last modified date: 10/22/2024