canDelete functionality

Discuss all feature requests you have for a new Servoy versions here. Make sure to be clear about what you want, provide an example and indicate how important the feature is for you

canDelete functionality

Postby martinh » Wed Jan 06, 2010 12:08 pm

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
Martin
------------------------------------------------
Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
martinh
 
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium

Re: canDelete functionality

Postby mboegem » Wed Jan 06, 2010 12:18 pm

If you use an Error handler method (solution property) you can easily catch this error type and display a neat message to your users...
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: canDelete functionality

Postby martinh » Wed Jan 06, 2010 12:48 pm

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
Martin
------------------------------------------------
Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
martinh
 
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium

Re: canDelete functionality

Postby jcompagner » Thu Jan 07, 2010 11:46 am

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)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: canDelete functionality

Postby birgit » Fri Jan 08, 2010 11:30 am

Hi

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

Regards
Birgit
Birgit Rieder
7r gmbh, Switzerland
SAN Developer
User avatar
birgit
 
Posts: 302
Joined: Sun Jan 15, 2006 10:04 pm
Location: Switzerland

Re: canDelete functionality

Postby Robert Huber » Fri Jan 08, 2010 12:16 pm

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 wrote: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
Robert Huber
7r gmbh, Switzerland
SAN Developer
www.seven-r.ch
User avatar
Robert Huber
 
Posts: 1239
Joined: Tue Aug 23, 2005 6:52 pm
Location: Schaffhausen, Switzerland

Re: canDelete functionality

Postby lwjwillemsen » Fri Jan 08, 2010 5:53 pm

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,
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: canDelete functionality

Postby patrick » Sat Jan 09, 2010 2:04 pm

But that can only be Servoy relations, I think. You deletion can still fail then if there are DB constraints...
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: canDelete functionality

Postby lwjwillemsen » Sat Jan 09, 2010 6:20 pm

Sure, but it is still very nice to be able to check your own Servoy data model (relations)...
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: canDelete functionality

Postby birgit » Sat Jan 09, 2010 7:24 pm

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

Regards
Birgit
Birgit Rieder
7r gmbh, Switzerland
SAN Developer
User avatar
birgit
 
Posts: 302
Joined: Sun Jan 15, 2006 10:04 pm
Location: Switzerland

Re: canDelete functionality

Postby pbakker » Mon Jan 11, 2010 12:09 pm

You can already do this, using the solutionmodel

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: canDelete functionality

Postby martinh » Mon Jan 11, 2010 12:35 pm

pbakker wrote:You can already do this, using the solutionmodel

Paul


That's what I thought, by writing a recursive method?
Martin
------------------------------------------------
Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
martinh
 
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium


Return to Discuss Feature Requests

Who is online

Users browsing this forum: No registered users and 11 guests