I am trying to delete specific data (using the button delete) from the table but when I implemented the delete it deletes the data from the database too. I need to store the data but from only the client page it will be deleted. (I want to implement soft delete)
Hello
For this use case you can create a Attribute into your database table (entity) like
To do a soft delete you can add an attribute to an entity called "isDeleted" or "isActive" (or anything you'd like , Then in you aggregates in your application you filter out all of the isDeleted ones.
IsDeleted" or "IsActive" (or anything you'd like) with data type Boolean, and set the default value to true so whenever you create a data it will save IsActive as true.
and when you delete the data you don't need to use delete entity action. on the delete button you update that attribute for the record you want to soft delete.
IsActive = false
And where ever you are showing your data from the aggregate just use the filter on that aggregate as
Employee.IsActive = True
Only data which is true will be fetched and shown on your client side
meanwhile in your DB all the data will be stored.
I am also attaching Sample Oml
Sample -
https://personal-wwkmlamd.outsystemscloud.com/DemoApplication/Employees
Hope this helps
Best Regards
Tousif Khan
Hello. Thank you so much for your explanation. It works properly.
Hi Mosharof ,
There are many threads about this subject,
I share a link one of them. try to see answer to see the next steps you should take :)
https://www.outsystems.com/forums/discussion/75330/soft-delete/
Thanks
Hi,
When you defined the IsActive attribute you can also set it on the Entity definition, which will then ensure that on any aggregate you create the filter on the IsActive = True is added by default:https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Data/Modeling_Data/Entity