How do I clean the data from my Entities, so that I can start again with good data?
There are two approaches to delete all data from your entities:
- Using the Delete Entities action;
- Perform this through a SQL Query.
To use the Delete Entity action, you need to:
- Get all the records from your database;
- Use a For each to iterate over the list;
- Delete each record.
The following image shows this approach:
As a faster alternative, you can create a SQL Query to delete everything from your Entity:
Most likely you will reach to a point in time during the project where the users would like to clean test data and start from scratch with good data.
It is a good practice to create a mechanism to delete data for each entity, or for all entities on the eSpace. If you make the action public, users can just reference this action to restart from scratch.
You have to be careful with the relationships between entities. Usually you have to delete first the entities that you have created more recently, because those usually have the relations to "older" entities.