Logic

Hi Good People...

I'm creating an application, which Calculates all expenses. It shows TOTAL, DATE, and Created BY...it also has an option to clear/delete the calculated records... 

Now my question is, which logic should I implement in order for it to save deleted records in another screen (bin or history) so that the user will be able to retrieve deleted records in the future.



thank you in advance

Screenshot (14).png

Solution

I did an example, but you should follow José's advice, of learning and then going to things more difficult and with more logic, without the foundation your logic will not grow so much or it will grow slowly.

1- you need to put this attribute, isDeleted

2- to list all the expenses that are not temporarily deleted your filter the list using the isDeleted attribute that we inserted in the expenses' entity

3- To list all expenses that are on the bin you filter again using the isDeleted attribute but in this case, you want the records that were "deleted"

 

To change the attribute I will use a server action that I created to update that record on the database where I will put the isDeleted attribute is true


I have done an example and you can play a little if you want. I will give you my OML. Let me know if it helped you :)

You have the screen of expenses and expenses in, the bin is where are all the records that were deleted but are still in the database. You have two options on the expenses screen, to delete the record temporarily, or to delete it permanently.

https://marcio-carvalho4.outsystemscloud.com/SoftDelete/Expenses

Regards,

Márcio

SoftDelete.oml

Hi Tafadzwa,

I think the easiest way to manage that data is always save the calculations in the database in a table where a flag called IsDeleted determines if the calculation is active or deleted. Then in the history screen you just need to display records with IsDeleted = True.

Regards

Hey! Dont get me wrong, but...

What is the difference between this post  https://www.outsystems.com/forums/discussion/75590/logic/ and this one where I am answering you?

All of the people that gave you an answer, gave you good hints to go with a solution. Maybe if you don't understand how to develop that you should have asked in the other post and not created another one with the same question.

Regards,

Márcio


yes, I didn't know how to develop it...  I will be very gland if someone does olm for me I think l will be able to understand better.. 

Tafadzwa, you should start by investinng some time learning from the courses:

https://www.outsystems.com/training/courses/

Solution

I did an example, but you should follow José's advice, of learning and then going to things more difficult and with more logic, without the foundation your logic will not grow so much or it will grow slowly.

1- you need to put this attribute, isDeleted

2- to list all the expenses that are not temporarily deleted your filter the list using the isDeleted attribute that we inserted in the expenses' entity

3- To list all expenses that are on the bin you filter again using the isDeleted attribute but in this case, you want the records that were "deleted"

 

To change the attribute I will use a server action that I created to update that record on the database where I will put the isDeleted attribute is true


I have done an example and you can play a little if you want. I will give you my OML. Let me know if it helped you :)

You have the screen of expenses and expenses in, the bin is where are all the records that were deleted but are still in the database. You have two options on the expenses screen, to delete the record temporarily, or to delete it permanently.

https://marcio-carvalho4.outsystemscloud.com/SoftDelete/Expenses

Regards,

Márcio

SoftDelete.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.