Deleting Multiple Objects¶
This API deletes multiple objects in a data table with a single request. Consider the following example, it demonstrates an API call which deletes all objects in the Person
data table where the value of the age
property is greater than 20
:
Backendless.data.of("Person").remove(whereClause: "age > 20").then((objectsDeleted) {
print("Server has deleted $objectsDeleted objects");
});
Method¶
Future<int> Backendless.data.of("TABLE-NAME").remove({Map entity, String whereClause});
Future<int> Backendless.data.withClass<E>().remove({E entity, String whereClause});
where:
Argument | Description |
---|---|
TABLE-NAME |
Name of the table where the objects expressed via Map instances will be updated. |
E |
Dart class of the data objects to update in the database. |
whereClause |
A condition for selecting objects to be deleted in the data table. |
The method returns the number of objects deleted in the databfase.
Codeless Reference¶
where:
Argument | Description |
---|---|
table name |
Name of the data table where objects will be deleted from. |
where clause |
A condition for selecting objects to be deleted in the data table. Refer to the Search With The Where Clause topic for more information. |
Returns the number of deleted objects.
Consider the following records in the employees
data table:
The example below is set to delete all values from the position
column that match the where clause
condition, (e.g. 'Manager'
). In this case, the condition acts like a filter and deletes all values that match the criteria 'Manager'
.
The result of this operation will look as shown below after the Codeless logic runs. As you can see, two records containing the 'Manager'
value in the position
column were deleted from the data table.
Also, the operation has returned the number 2
, indicating the number of deleted objects in the employees
data table.