Bulk delete aggregate results / bulk delete entity action


It would be handy to have the ability delete all the results of an Aggregate and also to have a Bulk Delete action for an entity.

Created on 15 Mar
Comments (5)

There two hacks in ServiceStudio to accomplish something similar.

1. Delete all rows from Table

  • Select the Entity in the Data tab (EntityName
  • Copy the entity from the context menu.
  • Paste the entity from the context menu (create EntityName2)
  • Delete the EntityName.
  • Rename EntityName2 to Entity Name

Note this method also resets the EntityName identifier back to 1.

2.  SQL Aggregate

  • In non SQL Aggregate, copy the generated SQL statement.
  • Create a new SQL aggregate and past the the copied SQL Statement.
  • Surround the SQL statement in a commit transaction (SQL Server and Oracle differ in syntax)
  • Click the Test button

Note this method preserves the last used EntityName identifier.

Changed the category to Backend

The first hack doesn't work as it messes with the foreign keys (unless you don't have relationships between entities that is).

I'm not sure about your second hack as I wouldn't know where to copy the generated SQL from, however I just added my own SQL to the effect of:

DELETE from {MyEntity} WHERE {MyEntity}.[MyAttribute] = @MyAttributeVariable;

However it would be better if there was a quick and simple way to clear an entity of all data, particularly handy if your data model changes and indexing edits conflicts with existing data.

Also the ability to pass a parameter (filter) for the data to be deleted would be really handy, as well as a basic delete all.

Erik -

That's really not what was asked for, original poster is just looking for something that accepts a record list that has IDs in it and deletes them, rather than calling DeleteXYZ within a ForEach on the record list.