Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions

Transformation Language Reference

Transformation Language Reference

ERROR

ERROR

Causes the
Data Integration Service
to skip a row and issue an error message, which you define. The error message displays in the log. The
Data Integration Service
does not write these skipped rows to the reject file.
Use ERROR in Expression transformations to validate data. Generally, you use ERROR within an IIF or DECODE function to set rules for skipping rows.
Use the ERROR function for both input and output port default values. You might use ERROR for input ports to keep null values from passing into a transformation.
Use ERROR for output ports to handle any kind of transformation error, including ERROR function calls within an expression. When you use the ERROR function in an expression and in the output port default value, the
Data Integration Service
skips the row and logs both the error message from the expression and the error message from the default value. If you want to ensure the
Data Integration Service
skips rows that produce an error, assign ERROR as the default value.
If you use an output default value other than ERROR, the default value overrides the ERROR function in an expression. For example, you use the ERROR function in an expression, and you assign the default value, ‘1234’, to the output port. Each time the
Data Integration Service
encounters the ERROR function in the expression, it overrides the error with the value ‘1234’ and passes ‘1234’ to the next transformation. It does not skip the row, and it does not log an error in the log.

Syntax

ERROR(
string
)
The following table describes the argument for this command:
Argument
Required/
Optional
Description
string
Required
String value. The message you want to display when the Integration Service skips a row based on the expression containing the ERROR function. The string can be any length.

Return Value

String.

Example

The following example shows how to reference a mapping that calculates the average salary for employees in all departments of the organization, but skip negative values. The following expression nests the ERROR function in an IIF expression so that if the
Data Integration Service
finds a negative salary in the Salary port, it skips the row and displays an error:
IIF( SALARY < 0, ERROR ('Error. Negative salary found. Row skipped.', EMP_SALARY )
SALARY
RETURN VALUE
10000
10000
-15000
'Error. Negative salary found. Row skipped.'
NULL
NULL
150000
150000
1005
1005

0 COMMENTS

We’d like to hear from you!