Hello Everyone I am practicing Appian I have a case where I am fetching data from database using expression rule now I want to add a custom field to each record that is returned with the data subset
please Notice that this field doesn't exist on the table how can I accomplish this check the below example to better understand my question
Let us say I have a table called students that has the following columns id, name and age when I perform a query it will fetch these columns I want it to retrieve extra custom column that doesn't exist in any other table lets say I want to add a column called rank with a custom value either hard-coded or passed as a parameter
Thanks in advance
Discussion posts and replies are publicly visible
If you already have a CDT that maps to that table, you can create a second helper CDT that does not map to any table (i.e. do not publish in a data store), but that has all of the same fields plus an additional field that you use for your "custom value".
Then, in your expression rule you can call a!forEach and use a type constructor to build the CDT you're looking to build.
a!forEach(
items:local!myItems /*this is the result of some query you did to grab the data from the table*/
expression:type!mySecondCDT(
field1:local!myItems.field1
fieldN:local!myItems.fieldN
customField:1234 /*put whatever you want here*/
)
Then if you need this in a datasubset type, just use todatasubset() over it.