Previous Topic: $NUMBER FunctionNext Topic: $OPSYSTEM Function


$NUMERIC Function

$NUMERIC evaluates to a value of True if the value of the specified identifier can be used in CA Ideal arithmetic. It evaluates to a value of False if the use of the identifier causes an arithmetic or conversion error. It evaluates to a value of Unknown if the value of the identifier is null.

This function has the following format:

$NUMERIC(name)
name

Specifies an identifier of a numeric or alphanumeric field or of an alpha group.

For $NUMERIC to return a value of True for an alphanumeric item, the item must consist only of an optional sign (+ or ‑) followed by numerals with one optional decimal point. Leading or trailing blanks are permitted, but are ignored in the alphanumeric input value.

For $NUMERIC to return a value of True for a numeric item, the item must have a valid numeric internal representation. (An example of a numeric field that does not return True is a numeric packed or binary field that redefines an alphanumeric field.)

You can only test 31 significant digits, exclusive of leading zeros.

The $NUMERIC function tests whether a value can be converted to a numeric data type. It does not test whether the value is actually numeric. Therefore, when testing a panel field for a numeric entry, use the function $PANEL‑FIELD‑ERROR.

If the identifier to test is nullable, test for null values (for example, IF identifier IS NULL ...) before testing with $NUMERIC. The function evaluates to Unknown if the value of the identifier is null.

Example

IF $NUMERIC (ORDER_FORM.QUANTITY) THEN
	SET EXTENSION = $NUMBER(ORDER_FORM.QUANTITY) * PRICE
	ELSE
	DO NON_NUM_QTY
	ENDIF