a!defaultValue Function

Function

a!defaultValue( value, default )

Returns a default value when the specified value is null or empty. When there are multiple default parameters, each parameter is evaluated in order and the first non-null and non-empty default will be returned. Null, "", and {} are all considered null or empty values.

See also: if(), isnull()

Parameters

Keyword Type Description

value

Any Type

Value to be returned if not null or empty.

default

Any Type

Default value to return when value is null or empty.

Returns

Any Type

Usage considerations

Using default values

  • This function accepts multiple default parameters, and each parameter will be evaluated in order until the first non-null and non-empty default is returned. For example, a!defaultValue("", null, "N/A") returns "N/A".
  • If you add a list of values as a default value, they will be treated as a single value. For example, a!defaultValue({1, null, 3}, 4) would return {1, null, 3}.
    • A list of nulls or empty text are not considered null or empty. For example, a!defaultValue({null, null, null}, 3) returns {null, null, null}, and a!defaultValue({"", "", ""}, 3) returns {"", "", ""}.
    • An empty list is considered null or empty. For example, a!defaultValue({}, 3) returns 3.

Examples

  • a!defaultValue(null, 1) returns 1
  • a!defaultValue(1, “default”) returns 1
  • a!defaultValue({}, "default") returns "default"
  • a!defaultValue("", "default") returns "default"
  • a!defaultValue(null, "") returns ""
  • a!defaultValue(null, "", {}) returns {}
  • a!defaultValue({null, null, 1, null}, {2, 3, 4, 5}) returns {null, null, 1, null}

Feature compatibility

The table below lists this function's compatibility with various features in Appian.
Feature Compatibility Note
Portals Compatible
Offline Mobile Compatible
Sync-Time Custom Record Fields Compatible

Can be used to create a custom record field that only evaluates at sync time.

Real-Time Custom Record Fields Incompatible
Process Reports Incompatible

You cannot use this function to configure a process report.

Process Events Incompatible

You cannot use this function to configure a process event node, such as a start event or timer event.

Open in Github Built: Fri, Jan 27, 2023 (07:42:59 PM)

On This Page

FEEDBACK