@IsError (Formula Language)

Returns 1 (True) if the value is an @ERROR value, returns 0 (False) if not an error.

Syntax

@IsError( value )

Parameters

value

Number. Can be a literal value or a field name containing data of type Number.

Return value

flag

Boolean

  • Returns 1 (True) if the value is an @ERROR value
  • Returns 0 (False) if not an error

Usage

Since this function intercepts the error message and replaces it with your own value, if you do have an error, you may have trouble figuring out what's causing the error. For debugging purposes, you may want to temporarily remove the error handling so that you can see the error message text or, display the text as shown in example 5.

Examples

  1. This example returns 1.
    @IsError(1/0)
  2. This example returns 0.
    @IsError(1/2)
  3. This formula checks to see if there is an @ERROR in the Price field, and returns "There is an error in the price field" if it encounters an error; otherwise it returns 0.
    @If(@IsError(Price); 
       @Failure("There is an error in the price field"); @Success)
  4. This agent tests the return value of an @DbLookup statement for an error. If the @DbLookup statement causes an error, the agent returns the text "Not available."
    FIELD Phone := @DbLookup(""; "Snapper" : "names.nsf"; "People";
    @Right(Name; " ") + " , " + @Left(Name; " "); "OfficePhoneNumber");
    @If(@IsError(Phone);"Not available")
     
  5. This returns the lookup result if there is one, but if the lookup fails, it returns the text of the error message without causing an error condition. This may be useful in debugging.
    -tmp := @DbLookup("":"NoCache"; ""; "ById"; ID; 2); 
    @Text(_tmp); _tmp)