cast( typeNumber, value )
Converts a value from its existing type to the specified type.
See also: Casting, typeof(), Delete Data Types
Keyword | Type | Description |
---|---|---|
|
Number (Integer) |
The type to which the value should be cast. This may be retrieved by using typeof(x), where x is a value of the intended type, or referencing a type with 'type!{namespace}type-name' (within single quotes). |
|
Any Type |
The value that should be cast to type typeNumber. |
Any Type
typeof(x)
, where x
is a value of the intended type, or reference a type with type!{namespace}type-name
(within single quotes).1
2
3
4
cast(
'type!{http://www.appian.com/ae/types/2009}Integer',
123.4
)
Returns 123
.
1
cast(1, 123.4)
Returns 123
.
1
cast(typeof(123), 123.4)
Returns 123
. typeof(123)
returns 1, the type number for Integer.
Use a!listType
to cast a list of values to a certain type of list.
1
2
3
4
cast(
a!listType(type!Integer),
{1, 2.0, 3.1, "23", "2.34", true, null}
)
Returns { 1, 2, 3, 23, 2, 1, null }
.
1
2
3
4
cast(
a!listType(typeof(1.0)),
{ 1, 2.0, 3.1, "23", "2.34", true, null }
)
Returns { 1, 2.0, 3.1, 23, 2.34, 1, null }
. typeof(1.0)
returns the type number for Decimal.
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 | Compatible | |
Process Events | Compatible |
cast() Function