If Exists/Not-Exists Expression Functions

On This Page

exists

exists(ATTRIBUTE)

Checks whether an attribute with the specified name (ATTRIBUTE — see Attribute Variables) exists in the evaluated item.

For example, exists(Vendor) returns true if the evaluated item has a Vendor attribute.

if_not_exists

if_not_exists(ATTRIBUTE, VALUE)

If the specified attribute (ATTRIBUTE — see Attribute Variables) exists, the function returns its value. Otherwise, the function returns the default value specified in the VALUE parameter.

For example, a "SET lastName = if_not_exists(lastName, '')" update expression creates a lastName attribute and initializes its value to an empty string, provided the attribute doesn't already exist; if the attribute exists, it will be reassigned its current value (i.e., remain unchanged).

Note
if_not_exists is supported in update expressions.

See Also