Updating the dictionary

I have a requirement where I have to remove data from one database suppose abc and update the data of another database abc1 at the same time.

These both CDT  values are in different grid. After removing the values from first cdt then only 2nd cdt should update.

Deleted values are getting stored in one ruleinput. By taking that as reference I have to update second cdt. Both these cdt have common cif. How can i implement this.

My current implementation:

a!save(
ri!crAppGroupRelation_cdt,
a!forEach(
items: ri!crAPPGCDeleteSelection_cdt,
expression: updatedictionary(
cast(
typeof(
'type!{urn:com:appian:types:abc}CR_APP_GroupRelation'()),
ri!crAppGroupRelation_cdt

),
{
isJointUtilized_int: 0,

}
)
)
)

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    a!forEach(

    items: ri!input

    expression{

    /*This I think is the key, that you can use curly braces to represent the "expression" that is output.  It's actually a series of expressions in a container*/

    a!save(local!tempVariable, index(table, wherecontains(identifier of row you want to grab, table.column))), /*first save saves what you want to transfer*/

    a!save(table, insert(table, local!tempVariable, indexYouWantToStoreItAt)), /*second in your list of saves puts it in the destination

    a!save(table, remove(table, wherecontains(identifier of row you want to grab, table.column))) /*third in your list of saves removes the row from the source*/

    }

    2 and 3 can be swapped, but in this order, it allows you to put logic in to check to make sure everything is good before deleting your source data if you need to.

    You'll create a read, place elsewhere, delete original for each item in your forEach.  So save(index), save(insert), save(remove), save(index), save(insert), save(remove).... a set of three saves for each item.  It's a very good idea to test the architecture on a very simple case then when it works apply it to your much bigger problem.