You are currently reviewing an older revision of this page.
For an application that contains two process variables with the same name, casting a custom data type (CDT) to a new type returns inconsistent, unexpected data.
For example, imagine that an application has two process variables named pv!sameName, and this process variable populates the data for two different CDTs. Then, both of these CDTs are cast to a CDT named CDT_Casted_Type that unifies the data types in these two CDTs. A process report is then constructed with the following column definition expressions:
pv!sameName
CDT_Casted_Type
=pv!sameName
=cast('type!{urn:com:appian:types}CDT_Casted_Type', pv!sameName)
These columns should display nearly the same data, as the cast should only alter the data type. However, some of the rows in this report show that these column definition expressions are returning completely different data values.
Appian has scalar and list versions for all types. For example:
In process analytics, Appian also has the concept of BULK versions of these types, which are evaluated by taking the negative value of the original type value. For example:
These BULK types allow Appian to perform a single evaluation of the column definition expression, rather than evaluate the column once per row. In the case described above, the process variable pv!sameName exists as the BULK version of its CDT type. However, the cast is enforcing that it must be converted to the regular, non-BULK type. In the process report, the column definition expressions are only evaluate once, and the result of a single evaluation of a non-BULK list is a pointer to the head of that list. This results in repeated, unexpected data values.
Ensure that the cast is of BULK type. This can be done by getting the type value of the CDT and negating it. For the example above, this requires making the following changes to the column definition expression:
cast('type!{urn:com:appian:types}CDT_Casted_Type', pv!sameName) becomes:
(-fn!tointeger('type!{urn:com:appian:types}CDT_Casted_Type'), pv!sameName)
Note: It is recommended to make an expression rule, for example getBulkTypeFromType, that passes in the normal type ('type{urn:com:appian:types}CDT_Casted_Type') and returns -fn!tointeger(ri!type). This way, if the conversion must be done for other process reports, there is only a single source of truth for this code.
getBulkTypeFromType
('type{urn:com:appian:types}CDT_Casted_Type')
-fn!tointeger(ri!type)
This article applies to all versions of Appian.
Last Reviewed: July 2018