Skip to main content
February 16, 2022
Solved

Configure Write to DSE - updating single field

  • February 16, 2022
  • 2 replies
  • 0 views

Online Course | Learning at Appian

In the video it is stated that if you save at the top-level, all fields are updated, which implies that if you save at the level of specific fields only those fields will be saved. Is this true?

I found out, instead null values are being inserted.

    Best answer by stewart.burchell

    What is saved is whatever is in the scope of the CDT you are using to map to the target datastore entity. So if you have a CDT with 5 attributes, and you set the third one to a value and leave the others blank then the update that is performed is for ALL 5 attributes - attributes 1,2,4 and 5 will be set to null, and attribute 3 to whatever value you set it to.

    If you only want to set a single attribute or a subset of the columns in your database table you have two choices:

    • you can create a "partial CDT" - that is, a CDT that maps to the same entity but only has the attributes you want to update
    • you can write a Stored Procedure to only update the columns you specify 

    ...or you can (as I've just seen in  [mention:126a676c85024855948336691b0a7b92:e9ed411860ed4f2ba0265705b8793d05] comment, accept that you retrieve the entire scope of your CDT, update the attribute you want to change, and write the whole CDT back to the table which in effect overwrites the entire row, all with the original values except for the one you changed.

    2 replies

    stefanhelzle0001
    Brainy
    February 16, 2022

    There is no field-level update in Appian. Fetch the whole row, modify the values and write it back.

    stewart.burchell
    February 16, 2022

    What is saved is whatever is in the scope of the CDT you are using to map to the target datastore entity. So if you have a CDT with 5 attributes, and you set the third one to a value and leave the others blank then the update that is performed is for ALL 5 attributes - attributes 1,2,4 and 5 will be set to null, and attribute 3 to whatever value you set it to.

    If you only want to set a single attribute or a subset of the columns in your database table you have two choices:

    • you can create a "partial CDT" - that is, a CDT that maps to the same entity but only has the attributes you want to update
    • you can write a Stored Procedure to only update the columns you specify 

    ...or you can (as I've just seen in  [mention:126a676c85024855948336691b0a7b92:e9ed411860ed4f2ba0265705b8793d05] comment, accept that you retrieve the entire scope of your CDT, update the attribute you want to change, and write the whole CDT back to the table which in effect overwrites the entire row, all with the original values except for the one you changed.