canDelete functionality

Hi,

@Servoy, is it possible to add a functionality that checks if you can delete a record which returns true/false?

Now when you delete a record and if the relation restriction doens’t allow it, it throws an error.
But I would like to inform my user before doing the real delete.

I’ve been thinking and I think I can write something like this using the SM and check it myself using a recursive method, but of course it would be better if this is standard functionality in Servoy.

Martin

If you use an Error handler method (solution property) you can easily catch this error type and display a neat message to your users…

Hi Marc,

That is how it works now, but errorhandler is for me errors.
And it will show an error in the log and send an email to our support department.
I want to avoid that.

Even more perfect I would like to tell the user, what relation causes that the record can not be deleted.
For example if you want to delete a customer and there are still invoices for that customer, then the relation customer_to_invoice doesn’t allow onParentDelete, DeleteChildren

So if Servoy can’t do this, I’ll write a recursive method myself.
But if Servoy can, it would be a good functionality for all of us

Martin

there is currently no hook that sits between the delete and that exception
the only way currently is by the errorHandler (i think try/catch around delete also doenst work because that exception isnt catchable)

Hi

I would appreciate a couldBeDeletet() method as well.
See also http://www.servoy.com/forum/viewtopic.php?f=22&t=12003

Regards
Birgit

Hi Martin

I completely agree! We also asked for that some time ago, as we model the data (with Entity Modeler) and put all relevant business logic information in there, which means there is quite a bit of logic in the database. But unfortunatly it is not so well accessable right now from Servoy. So hopefully we will be heard :-)

Best regards, Robert

martinh:
Hi,

@Servoy, is it possible to add a functionality that checks if you can delete a record which returns true/false?

Now when you delete a record and if the relation restriction doens’t allow it, it throws an error.
But I would like to inform my user before doing the real delete.

I’ve been thinking and I think I can write something like this using the SM and check it myself using a recursive method, but of course it would be better if this is standard functionality in Servoy.

Martin

Hi there,

Johan, count me in on this one !

A Servoy deleteTest() function which checks the relations is very much wanted for us…

If it could return in case return value false the failing relation names we would be even happier !

Regards,

But that can only be Servoy relations, I think. You deletion can still fail then if there are DB constraints…

Sure, but it is still very nice to be able to check your own Servoy data model (relations)…

I agree: If Servoy relations coul be checked in advance (before delete command), that would be nice.

Regards
Birgit

You can already do this, using the solutionmodel

Paul

pbakker:
You can already do this, using the solutionmodel

Paul

That’s what I thought, by writing a recursive method?