Name

error — Raise an error condition.

Syntax

error(message)
              

The ERROR function has the following argument:

message

The message associated with this error.

Description

This function will cause an error condition to occur. The value in the function will be returned in the error message. This function can be used to catch and highlight unwanted conditions.

Although semantically this function returns a string value, in practice an error condition is always raised and processing is interrupted. In order to use this function in a context where a number is expected (such as the else clause of a if function) a cast expression can be used.

Examples

Formula

Description

Result

if(FU='',error('Missing an FU assignment'),FU)

If the FU variable is blank then raise an error. Otherwise return the FU code.

FU (or error)

if(YC gt 22,int(error('Does not apply to YC '+YC)),YC)

Test that YC is within range. Cast the error function as an int in order to be compatible with the non-error condition.

YC (or error)