Functions and Directives

Function NullIf() Foundation

Returns a NIL/NULL value if the two specified expression values are equivalent

NullIf( <Expression> , <Expression> ) --> lEqual
Specifies the expression to be evaluated.

NullIf() returns the first <Expression> if two expressions are not equivalent. If the expressions are equivalent, NullIf() returns a NULL/NIL value.


The function NullIf() can be used to perform the inverse operation of the Coalesce() function. The following pseudo code illustrates a typical scenario for the usage of the function NullIf().

In the sample code below, the function Coalesce() is used to transform data for input/output handling. Lateron the function NullIf() is used to write back changed data to the database field. If data has not been changed, the database field retains its NULL/NIL value.

// display description if given, otherwise display 
// an informational message 
cOutput := Coalesce(FIELD->DESCRIPTION , "(no description available)") 

// - display the value of cOutput 

// - now the user can change the data 

// assign new value or NIL if no data was entered. 
FIELD->DESCRIPTION := NullIf(cOutput,"(no description available)") 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.