Skip to content

Updating Multiple Objects

This API updates multiple objects in a data table with a single request. Consider the following example, it demonstrates an API call which updates all objects in the Person data table where the value of the property age is greater than 20. As a result of the request, all updated objects will have the contactType property set to "personal":

Map changes = {"contactType": "personal"};
Backendless.data.of("Person").update("age > 20", changes).then((objectsUpdated) {
  print("Server has updated $objectsUpdated objects");
});

Method

Future<int> Backendless.data.of("TABLE-NAME").update(String whereClause, Map changes);
Future<int> Backendless.data.withClass<E>().update(String whereClause, Map changes);

where:

Argument                Description
TABLE-NAME Name of the table where the objects expressed via java.util.Map instances will be updated.
E Java class of the data objects to update in the database.
whereClause A condition for selecting objects in the data table which will be updated.
changes An instance of java.util.Map containing the changes which will be applied to all objects in the data table which match the condition expressed via whereClause.

Return Value

The method returns the number of objects updated in the database.