How to not inset the duplicates into the database

Hi All,

code:-

!buttonArrayLayout(
buttons: {
a!buttonWidget(
label: "Create",
saveInto:{

a!forEach(items: local!filter,expression:a!save(local!items, append(local!items,{customerid: local!filter.customernumber[fv!index], tag: local!filter.tag.tagname[fv!index], portfolioname: local!filter.value[fv!index], portfolioid: local!filter.customerid[fv!index], tagid: local!filter.tag.tagid[fv!index]}))),

a!writeToDataStoreEntity(
dataStoreEntity: cons!portfoliomasterorg,
valueToStore: local!items
in the above code i am trying to insert the data into Db. how to not insert the duplicates into DB. Please help me to resolve the issue.
Thank you

  Discussion posts and replies are publicly visible

Parents Reply
  • Without fully digesting all of your code, this can occur if you are not populating the unique ID values for existing rows before writing the CDT to the DB, so Appian does not realize this should not be a re-entry (update vs insert).  If there is no need to update entries, you would want to query for which values are already in the DB, and remove those from the CDT before persisting your data.

Children