cast() Function Share Share via LinkedIn Reddit Email Copy Link Print On This Page Function cast( typeNumber, value ) Converts a value from its existing type to the specified type. See also: Casting, typeof(), Delete Data Types Parameters Keyword Type Description typeNumber 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). value Any Type The value that should be cast to type typeNumber. Returns Any Type Usage considerations Referencing data types To retrieve the type number, use typeof(x), where x is a value of the intended type, or reference a type with type!{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 portals In portals, you cannot cast a value to a record type. Examples Casting a value 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. Casting a list of values 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 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 Feedback Was this page helpful? SHARE FEEDBACK Loading...