--- title: "ifNotEmpty" slug: "calc-function-if-not-empty" updated: 2026-05-12T12:18:24Z published: 2026-05-12T12:18:24Z canonical: "docs.lobstersoftware.com/calc-function-if-not-empty" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # ifNotEmpty *See also:* [ifEmpty](/v1/docs/en/calc-function-if-empty) , [if (if, then, else)](/v1/docs/en/calc-function-if) , [cmp (Compare)](/v1/docs/en/calc-function-cmp) , [trim (Calculation expression – cutting off whitespaces)](/v1/docs/en/calc-function-trim) > [!NOTE] > The function $ifNotEmpty follows the same rules as [if (if, then, else)](/v1/docs/en/calc-function-if), except that a fixed value or expression to be checked for empty is passed as a condition. > > > [!TIP] > > Tooltip > > > > Syntax: *$ifNotEmpty(expression,thenValue[,elseValue])* > > > > | Parameter | Description | > > | --- | --- | > > | `expression` | A fixed value or expression which is checked for empty. If the value is not 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, etc.). Thus a value, which consists only of spaces, is considered empty. | > > | `thenValue` | An optional value or expression that is evaluated and returned if the value of the *expression* is empty. | > > | `elseValue` | A static value or expression that is evaluated and returned when the value of the *expression* is not empty. | > > > > Returns the evaluated fixed value or the return value of the evaluated expression. If the value to be checked (*expression*) is empty and no *elseValue* is specified, the function returns *null/empty*. > > > > Example: $ifNotEmpty($el(12), field with id 12 is not empty, field with id 12 is empty). ## Syntax *$ifNotEmpty(expression,thenValue[,elseValue])* ## Parameter | Name | Description | | --- | --- | | expression | A fixed value or expression which is checked for empty. If the value is not 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, etc.). 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 not empty. | | elseValue | An optional value or expression that is evaluated and returned if the value of the *expression* is empty. | ## Return value Returns the evaluated fixed value or the return of the evaluated expression. If the value to be checked (expression) is empty and no elseValue is specified, the function returns *null/empt*y. ## Example | Syntax | Result | | --- | --- | | $ifNotEmpty(Jonas Abend,not empty,empty) | not empty | | $ifNotEmpty(0,not empty,empty) | not empty | | $ifEmpty( ,not empty,empty) | empty | | $ifEmpty( ,not empty,empty) | empty |