The Appian Documentation below does not explain how to prevent the updating of an existing value. I want to bring in new data, but if the primary key already exists, then I want to retain some of the old data while updating other values.
I tried doing something like:
if(isnull(rule!Query_Existing(pv!data.PrimaryKey)), "new data", "old Data") and save into the field
And the rule above passes the primary key and searches for the "old Data". The rule works by itself, but when I do this if statement, I get a null pointer exception.
Appreciate any help on this.
https://docs.appian.com/suite/help/21.4/Write_to_Data_Store_Entity_Smart_Service.html
Updating an Existing Value
The data that you write can update an existing record when a primary key is properly configured for the entity and provided by your node input.
Saving a new value for an existing record does not merge the records, the old record is overwritten.
Discussion posts and replies are publicly visible
Hello rajo0002 Please follow the below steps in order to update data into the datastore.1. Get old data from from data source using queryEntity() and store it in a variable ( variable data type will be CDT).2. Now update the new data the same variable and perform Write to data store entity.You will have all your new and old updated data.
You can use a!update() function to update a specific property in a CDT/Dictionary. And then you can write it to the DB.