ifEmpty

See also: ifEmpty, if (if, then, else), cmp (Compare), trim (Calculation expression – cutting off whitespaces)

The function $ifEmpty follows the same rules as $if, except that a fixed value or expression to be checked for empty is passed as a condition.

Syntax

$ifEmpty(expression,thenValue[,elseValue])

Parameter

Name

Description

expression

A fixed value or expression which is checked for empty. If the value is empty, the expression thenValue is evaluated, otherwise the optional expression elseValue.

►IMPORTANT◄ The transferred value is cleared of leading or attached whitespaces (e.g. spaces, tab, ...).
Thus a value, which consists only of spaces, is considered empty.

thenValue

A static value or expression that is evaluated and returned when the value of the expression is empty.

elseValue

An optional value or expression that is evaluated and returned if the value of the expression is not empty.

Return value

Returns the evaluated fixed value or the return of the evaluated expression. If the value to be checked (expression) is not empty and no elseValue is specified, the function returns null/empty.

Example

Syntax

Result

$ifEmpty(Jonas Abend,empty,not empty)

not empty

$ifEmpty(0,empty,not empty)

not empty

$ifEmpty( ,empty,not empty)

empty

$ifEmpty( ,empty,not empty)

empty