FunctionCopy link to clipboard
cast( typeNumber, value )
Converts a value from its existing type to the specified type.
See also: Casting, typeof(), Delete Data Types
ParametersCopy link to clipboard
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. |
ReturnsCopy link to clipboard
Any Type
Usage considerationsCopy link to clipboard
Referencing data typesCopy link to clipboard
- To retrieve the type number, use
typeof(x)
, wherex
is a value of the intended type, or reference a type withtype!{namespace}type-name
(within single quotes). - When referencing a data type, consider the impact that deleting the data type has on the expression that references it.
Use in portalsCopy link to clipboard
- In portals, you cannot cast a value to a record type.
ExamplesCopy link to clipboard
Casting a valueCopy link to clipboard
1
2
3
4
cast(
'type!{http://www.appian.com/ae/types/2009}Integer',
123.4
)
Copy
Returns 123
.
1
cast(1, 123.4)
Copy
Returns 123
.
1
cast(typeof(123), 123.4)
Copy
Returns 123
. typeof(123)
returns 1, the type number for Integer.
Casting a list of valuesCopy link to clipboard
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}
)
Copy
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 }
)
Copy
Returns { 1, 2.0, 3.1, 23, 2.34, 1, null }
. typeof(1.0)
returns the type number for Decimal.
Feature compatibilityCopy link to clipboard
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 | Compatible | |
Process Events | Compatible | |
Process Autoscaling | Compatible |