Update Rows

Update a Specific Row

You can update a single specific row in a Data Store table using the update() method. This enables you to update the values of one or more columns of the row by passing the modified values of the columns as key-value pairs.

The <ROW_INSTANCE> used in the code syntax below is the instance defined in the Row Instance page.

    
copy
<ROW_INSTANCE>.update( success: (ZCatalystRow) → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<ZCatalystResponse<ArrayList<ZCatalystRow>>>?

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getDataStoreInstance().getTableInstance("EmployeeDetails").getRow(2823000000095003, //Replace this with your table name and the ROWID of the row { row -> row.setColumnValue("Employee_Name", "Morgan Jones") row.update( { success -> println("Row updated successfully $success") }, { exception -> println("Failed to update the row $exception") } ) })

Update all Rows

You can update multiple row in a table by passing an array of the rows as an argument to the updateRows() method. This enables you to update the values of one or more columns of the rows, by passing the modified values of the columns as key-value pairs.

The <TABLE_INSTANCE> used in the code below is the instance defined in the Table Instance page.

    
copy
<TABLE_INSTANCE>.updateRows( rows: ArrayList<ZCatalystRow>, success: (List<ZCatalystRow>) → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<ZCatalystResponse<ArrayList<ZCatalystRow>>>?

Parameters:

  • rows: The array of rows to be updated

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getDataStoreInstance().getTableInstance("EmployeeDetails").updateRows( //Replace this with your table name rowsList, //Set the names and values of the columns and add them to an arrayList { println(">>>> Rows updated successfully $it") }, { println(">>>> Update Rows Failed $it") })

Last Updated 2023-09-03 01:06:41 +0530 +0530