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.
Parameters
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. |
Returns
Any Type
Examples
Basic
1
a!defaultValue(null, 1)
Copy
Returns 1
.
1
a!defaultValue(1, "default")
Copy
Returns 1
.
Using null or empty values
1
a!defaultValue("", "default")
Copy
Returns "default"
.
1
a!defaultValue(null, "")
Copy
Returns ""
.
1
a!defaultValue({}, "default")
Copy
Returns "default"
. An empty list is considered null or empty.
Using multiple default parameters
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, "", {})
Copy
Returns {}
.
1
a!defaultValue(null, "", 1, "", {})
Copy
Returns 1
.
Using lists
1
a!defaultValue({1, 9}, {2, 3, 4, 5})
Copy
Returns {1, 9}
. A list of values is treated as a single value of type list.
1
a!defaultValue({null, null}, {3})
Copy
Returns {null, null}
. A list of nulls is not considered null or empty.
1
a!defaultValue({"", "", ""}, {3})
Copy
Returns {"", "", ""}
. A list of empty text is not considered null or empty.
1
a!defaultValue({{1,2,3}, {4,5}}, "default")
Copy
Returns {1, 2, 3, 4, 5}
. Lists of lists are flattened.
1
a!defaultValue(null, {2, {3, 4}, 5})
Copy
Returns {2, 3, 4, 5}
. Lists of lists are flattened.
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 | 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. |