Data Transformation Engine Map Designer Reference Guide
Chapter 15 - Managing Invalid Data Using the CONTAINSERRORS Function
Map Designer Reference Guide
239
In this input file of customers, the third customer record is invalid.
Gisela,1252 S. Broward/Ft. Lauderdale,523-2622,22
Dede,1513 Palatine Rd./Boca Raton,252-6560,86
Lewis,74099 S. 67th Ave/Ft. Lauderdale,332-8665,3.3
Eric,6933 Main St./South Miami Beach,291-7281,56
To generate a report that indicates whether each customer object is valid, assign a
Restart attribute to Customer(s) in the input.
The output report is composed of Line(s), where Line is defined as a text item.
The map rule on Line uses the
ISERROR function to check whether Customer is
invalid. If Customer is invalid, the result is INVALID Customer Data and the
REJECT of Customer. If Customer is valid, the result is GOOD Customer Data
and the
TEXT conversion of the Customer object itself.
The third Customer record is invalid, and the rest are good, with the resulting
output:
Using the CONTAINSERRORS Function
You may not want to map the input data if it contains any invalid data. In this
example or situation, use the
CONTAINSERRORS function. The CONTAINSERRORS
function has one input argument that is the name of the object you want to test.
The
CONTAINSERRORS function returns TRUE if the argument contains any invalid
object or returns FALSE if the argument does not contain any invalid object.
The
CONTAINSERRORS function only operates on a valid object.
For example, if you have the same input file as in the example above, the third
Customer record is invalid. You are mapping the input to the output file of
CustomerEntry(s). If the entire input contains any invalid object, do not produce
any output. If the entire input is valid, map the Customer(s) to
CustomerEntry(s), using the functional map MakeEntry.
Bad