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.
Keyword | Type | Description |
---|---|---|
|
Any Type |
Value to be returned if not null or empty. |
|
Any Type |
Default value to return when value is null or empty. |
Any Type
1
a!defaultValue(null, 1)
Returns 1
.
1
a!defaultValue(1, "default")
Returns 1
.
1
a!defaultValue("", "default")
Returns "default"
.
1
a!defaultValue(null, "")
Returns ""
.
1
a!defaultValue({}, "default")
Returns "default"
. An empty list is considered null or empty.
This function accepts multiple default parameters. Each parameter will be evaluated in order until the first non-null and non-empty default is returned.
1
a!defaultValue(null, "", {})
Returns {}
.
1
a!defaultValue(null, "", 1, "", {})
Returns 1
.
1
a!defaultValue({1, 9}, {2, 3, 4, 5})
Returns {1, 9}
. A list of values is treated as a single value of type list.
1
a!defaultValue({null, null}, {3})
Returns {null, null}
. A list of nulls is not considered null or empty.
1
a!defaultValue({"", "", ""}, {3})
Returns {"", "", ""}
. A list of empty text is not considered null or empty.
1
a!defaultValue({{1,2,3}, {4,5}}, "default")
Returns {1, 2, 3, 4, 5}
. Lists of lists are flattened.
1
a!defaultValue(null, {2, {3, 4}, 5})
Returns {2, 3, 4, 5}
. Lists of lists are flattened.
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 | Custom record fields that evaluate in real time must be configured using one or more Custom Field functions. |
Process Reports | Incompatible | Cannot be used to configure a process report. |
Process Events | Incompatible | Cannot be used to configure a process event node, such as a start event or timer event. |
a!defaultValue Function