Delete a Row

Catalyst Android SDK enables you to delete a single row from a specific Data Store table. However, you will not be able to delete multiple rows at a time.

You can delete a row from a table in either of these two methods:

Delete a Row by passing the Row ID to the Table Instance

You can delete a row from a table by passing the ROWID of the row as the argument to the deleteRow() method, as shown in the code syntax below.

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

    
copy
<TABLE_INSTANCE>.deleteRow( rowId: Long, success: () → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<Unit>?

Parameters:

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getDataStoreInstance().getTableInstance("Project").deleteRow(2823000000098007, //Replace this with your table name and the ROWID of the row { println("Row deleted successfully $it") }, { exception -> println("Delete Row failed $exception") })

Delete a Row by passing the Row Instance

You can delete a row from a table simply by calling the delete() method for the row instance.

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

    
copy
<ROW_INSTANCE>.delete( success: () → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<Unit>?

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.delete( { println("Row deleted successfully") }, { exception -> println("Delete row failed $exception") } )}, { exception -> println("Exception occured $exception") })

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