ISERROR

The ISERROR function tests an object to see if it is in error

You can use ISERROR to output your data in exactly the same order as it occurs in your input, both the valid data and the data in error. You can also use ISERROR to produce error messages for bad data in the same file in which you map your good data.

Syntax:
ISERROR (single-object-name)
Meaning:
ISERROR (object_to_test)
Returns:
"True" or "false"

ISERROR returns "true" when object_to_test is in error and returns "false" when object_to_test is completely valid.

Examples

  • InfoRec (s) = IF ( ISERROR ( Record:SomeFile ), "Bad --> " + REJECT ( Record:SomeFile ), "Ok --> " + TEXT ( Record:SomeFile ) )

    In this example, ISERROR is used to produce a report for all Record objects in SomeFile. If the record is in error, the InfoRec will have the text Bad --> followed by the data from the input Record. If the record is valid, the InfoRec will have the text Ok --> followed by the data from the input Record, such as:

    Ok  --> SZ-68839,486 Upgrade Microprocessor,186.86,100,W200
    Bad --> MK-19309,,369.43,417,W100
    Ok  --> KL-20349,PCMCIA Network Adaptor,174.82,29,N300
    Ok  --> WP-37679,AC Adaptor,39.48,245,E100
    Bad --> IL-39890,8MB Memory PCMCIA,390.48,0,S100
    

Related functions

  • CONTAINSERRORS