Return Values of Transformations
In those components in which transformations are defined, some return values can also be defined. They are integer numbers greater than, equal to or less than 0.
Remember that DBExecute can also return integer values less than 0 in form of SQLExceptions. |
-
Positive or zero return values
-
ALL = Integer.MAX_VALUE
In this case, the record is sent out through all output ports. Remember that this variable does not need to be declared before it is used. In CTL,
ALL
equals to2147483647
, in other words, it isInteger.MAX_VALUE
. BothALL
and2147483647
can be used. -
OK = 0
In this case, the record is sent out through the single output port or output port 0 (if component have multiple output ports, e.g. Map, Rollup, etc. Remember that this variable does not need to be declared before it is used.
-
Any other integer number greater than or equal to 0
In this case, the record is sent out through the output port whose number equals to this return value. These values can be called Mapping codes.
-
-
Negative return values
-
SKIP = - 1
This value serves to define that error has occurred but the incorrect record would be skipped and process would continue. Remember that this variable does not need to be declared before it is used. Both
SKIP
and-1
can be used.This return value has the same meaning as setting of
CONTINUE
in the Error actions attribute (which is deprecated since CloverETL 3.0). -
STOP = - 2
This value serves to define that error has occurred but the processing should be stopped. Remember that this variable does not need to be declared before it is used. Both
STOP
and-2
can be used.This return value has the same meaning as setting of
STOP
in the Error actions attribute (which is deprecated since CloverETL 3.0).The same return value is
ERROR
in CTL1.STOP
can be used in CTL2. -
Any integer number less than or equal to -1
These values should be defined by user as described below. Their meaning is fatal error. These values can be called Error codes. They can be used for defining Error actions in some components (This attribute along with Error log is deprecated since CloverDX 3.0).
-
Values greater than or equal to 0
Remember that all return values that are greater than or equal to 0 allow to send the same data record to the specified output ports only in the case of DataGenerator, Partition, Map and Rollup. Do not forget to define the mapping for each such connected output port in DataGenerator, Map, and Rollup. In Partition (and clusterpartition), mapping is performed automatically. In the other components, this has no meaning. They have either a unique output port or their output ports are strictly defined for explicit outputs. On the other hand, CloverDataReader and DBFDataReader always send each data record to all of the connected output ports.
-
Values less than -1
Remember that you do not call corresponding optional
OnError()
function of CTL template using these return values. To call any optional<required function>OnError()
, you may use, for example, the following function:raiseError(string Arg)
It throws an exception which is able to call such
<required function>OnError()
, e.g.transformOnError()
, etc. Any other exception thrown by any<required function>()
function calls corresponding<required function>OnError()
, if this is defined. -
Values less than or equal to -2
Remember that if any of the functions that return
integer
values returns any value less than or equal to -2 (includingSTOP
), thegetMessage()
function is called (if it is defined).Thus, to allow calling this function, you must add
return
statement(s) with values less than or equal to -2 to the functions that returninteger
. For example, if any of the functions liketransform()
,append()
orcount()
, etc. returns -2,getMessage()
is called and the message is written to Console.
-
-
Remember that if graph fails with an exception or with returning any negative value less then -1, no record will be written to the output file. If you want previously processed records to be written to the output, you need to return SKIP (-1). This way, such records will be skipped, the graph will not fail and at least some records will be written to the output. |