Update Rows

If a single row or multiple rows are to be updated with one or more column values in a table, the following method is used. The table used in the below code snippet is the table object.

The promise returned here will be resolved to an object in which the content key contains an array of updated row details.

Copied//Create an object with the details to be updated referring to the corresponding ROWID
var details = [
              { "Name": "John Denver", "Age": 25, "ROWID": 1510000000085482},
              { "Name": "Jill Scott", "Age": 39, "ROWID": 1510000000113707}
 ];
//Update The Row Object using details
var datastore = catalyst.table;
var table = datastore.tableId('SampleTable');
var updatePromise = table.updateRow(details);
updatePromise
           .then((response) => {
                   console.log(response.content);
 })
            .catch((err) => {
                   console.log(err);
});

A sample response that you will receive is shown below. The response is the same for both versions.

Web SDK

Copied[
  {
    CREATORID: "2136000000006003",
    MODIFIEDTIME: "2021-08-24 13:22:14:718",
    CREATEDTIME: "2021-08-24 13:12:55:999",
    Name: "John Denver",
    Age: 25
    ROWID: "2136000000034043"
  },
  {
    CREATORID: "2136000000006003",
    MODIFIEDTIME: "2021-08-24 13:22:14:728",
    CREATEDTIME: "2021-08-24 13:12:56:001",
    Name: "Jill Scott",
    Age: 39
    ROWID: "2136000000034045"
  }
]