Cleaning database or clean data in table
2750
Views
26
Comments
On our RadarOn our Radar
Database

if someone wants to clean data in table or clean whole database we don't have any action in entities actions like (create,update,createorupdate,delete,...) we should have deleteall action which will delete all the records based on some permission parameter  .we can use delete action but here we have to use for loop for iteration every record.

2016-04-21 20-09-55
J.
 
MVP

Hi,


you can use advanced queries for that, because the developer has to decide how to delete it na dhas to provide filters anyways.


In those case advanced queries are indeed your friend!

Merged this idea with 'Clean Environment Data Using Single Action' (created on 12 Jul 2017 09:53:55 by Manish Jawla)

Hi,

There must be one action which can automatically delete/truncate the entities created by users not the system entities because sometimes while testing the application we used to create lots of junk data and after that if want to clean the environment junk data it takes lots of effort if, we have more than 100 relational entities. Do not delete the data from static entity, only from standard entities, So that environment got cleaned easily. I know that for production this function must be disabled otherwise it will be a problem. 

Regards,

Manish jawla



This comment was:
- originally posted on idea 'Clean Environment Data Using Single Action' (created on 12 Jul 2017 by Manish Jawla)
- merged to idea 'Cleaning database or clean data in table' on 19 Jun 2021 14:24:58 by Justin James

Can't this be achieved by a database snapshot?



This comment was:
- originally posted on idea 'Clean Environment Data Using Single Action' (created on 12 Jul 2017 by Manish Jawla)
- merged to idea 'Cleaning database or clean data in table' on 19 Jun 2021 14:24:58 by Justin James
Merged this idea with 'Multi Delete Action at Entity Level' (created on 18 Oct 2018 14:22:22 by JitendraSinghYadav)

Hi Team,


Please add entity action for delete all as  DeleteAll or take list of ids as a input for multi delete.


Thanks!

You mean like on Mobile?

2014-02-07 17-02-43
Vasco Pessanha
Changed the category to
Backend

This will be really useful instead of having to iterate through each time

Hi Team,


Any update?


Thanks

Merged this idea with 'Function to delete all data' (created on 05 Jul 2021 09:01:53 by Eslam Ashraf)

It is possible to have (delete all) function in entities like the function which in the locale storage 



This comment was:
- originally posted on idea 'Function to delete all data' (created on 05 Jul 2021 by Eslam Ashraf)
- merged to idea 'Multi Delete Action at Entity Level' on 06 Jul 2021 13:25:09 by Daniël Kuhlmann
Merged this idea with 'Bulk delete aggregate results / bulk delete entity action' (created on 15 Mar 2019 16:46:35 by Sienna)

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.



This comment was:
- originally posted on idea 'Bulk delete aggregate results / bulk delete entity action' (created on 15 Mar 2019 by Sienna)
- merged to idea 'Multi Delete Action at Entity Level' on 06 Jul 2021 21:37:05 by Justin James

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.




This comment was:
- originally posted on idea 'Bulk delete aggregate results / bulk delete entity action' (created on 15 Mar 2019 by Sienna)
- merged to idea 'Multi Delete Action at Entity Level' on 06 Jul 2021 21:37:05 by Justin James
2014-02-07 17-02-43
Vasco Pessanha
Changed the category to
Backend


This comment was:
- originally posted on idea 'Bulk delete aggregate results / bulk delete entity action' (created on 15 Mar 2019 by Sienna)
- merged to idea 'Multi Delete Action at Entity Level' on 06 Jul 2021 21:37:05 by Justin James

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.



This comment was:
- originally posted on idea 'Bulk delete aggregate results / bulk delete entity action' (created on 15 Mar 2019 by Sienna)
- merged to idea 'Multi Delete Action at Entity Level' on 06 Jul 2021 21:37:05 by Justin James

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.



This comment was:
- originally posted on idea 'Bulk delete aggregate results / bulk delete entity action' (created on 15 Mar 2019 by Sienna)
- merged to idea 'Multi Delete Action at Entity Level' on 06 Jul 2021 21:37:05 by Justin James

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.

J.Ja



This comment was:
- originally posted on idea 'Bulk delete aggregate results / bulk delete entity action' (created on 15 Mar 2019 by Sienna)
- merged to idea 'Multi Delete Action at Entity Level' on 06 Jul 2021 21:37:05 by Justin James

Any update on this matter?

A delete all or delete a list of ids would be fantastic, as a create a list of elements would be too.
Sometimes in sync modules we need to use delete all and create a lot of data and need to use Advance SQL, but if we have large modules we end up with Monolithics or we break and have circular references ou exposed entities, both bad solutions...
If we use "for" we end up with slow solution...

Merged this idea with 'Delete All action for entity as same Crud Operation' (created on 03 Mar 2022 08:31:54 by Akshay Deshpande 🚀)

If we have 1000+ of record and want to delete that all record from entity. Right now, we are doing with two ways.
1) SQL query to delete record
2) for each and delete one by one

Instead of, this if we get one more action for Delete all like below screenshot. so, it will be easy or more handy to delete all records

It will be very handy to manage all records.

Merged this idea with 'Add delete All to remove all ' (created on 22 Feb 2023 13:35:23 by Sirajeddine Bouasker)

Hi,
This is a suggestion to add DeleteAll functionality to remove all records (rows) of an entity in an aggregate, or in page (when paginated), or remove all records from database (for example: remove all users (here all created users of the App ) not the OS plateform users (developer, admin, etc..)

PS: or is to specify different usecases, they can all implemented in one function, with an imput parameter to specify which usecase is wanted, otherwise, they can be implemented in different functions.

Kind regards,
Sirajeddine