Deleting Related Records

He everyone!

I have been teaching myself servoy, with no previous experience (I use to be the one who approved applications for companies(Bean counter)) things seem to be going well. Now on the other side of the fence the questions are a coming.

With the creation of releted tables and the data the within them how do you deal with the deletion of a record that is related to another.

There is more than way to skin a cat!

eg. A solution with Projects, Companies and People. If I have assoc. a person to projects and a company etc. If I delete the person from the database I am left with the personid in the project/person…with no way 5 years down the line to find out who may have worked on the project.

Logic dictates to me instead of deleting the record I should just change the status of the record from …Active to Deleted and then just filter it out so it can’t get added to any other records.

Is there another way of approaching this situation? Keep in mind the person details are of historical value.

Thanks

Hi 4xjbh

Unless the volume of data is going to be a big problem - I would always favour retaining ‘deleted’ records by changing their status when you have related records in other tables.

With Servoy relationships it is easy and very quick to filter your foundset to just the active records - and your client is going to be soooo grateful in two years time when they decide that they really do need the records after all. :)

Regards

Graham Greensall
Worxinfo Ltd

I was going to put the following in the onLoad method of each form.

Is there a better option?

controller.addFoundSetFilterParam('status','!=','Deleted');
controller.loadRecords();

J

May I suggest that you screen out the “deleted” or inactive records by method? That is, when ever you find records, add a line to your method to exclude those records.

In this way, you can show the inactive records to the user if they wish without restarting the solution.

Jim

While you are still in the market to skin a cat…

I find it more practical to move (archive) and deleted records to a mirrored archive table. This way you don’t have to code the filtering of deleted records and you can add history information to the archive table (delete date, deleted by user,…)

HTH

I might go the way of filtering out deleted records.
Are there any performance differences with the addFoundSetFilterParam and a Find/Search ?.