For some undefined reason var vResult = forms[vForm].controller.deleteRecord() returns false!? and records refuse to be deleted from the Sybase 10 db…
I don’t get any errors or log messages.
Would there be any logical reason that explaines this behaviour?
The issue occurs on Rich Client and on Developer.
Version 3.5.2_04-build 515
Java version 1.6.0_02-b06 (Windows XP)
Karel Broer:
I discovered a very weird issue in my solution…
For some undefined reason var vResult = forms[vForm].controller.deleteRecord() returns false!? and records refuse to be deleted from the Sybase 10 db…
I don’t get any errors or log messages.
Would there be any logical reason that explaines this behaviour?
The issue occurs on Rich Client and on Developer.
Version 3.5.2_04-build 515
Java version 1.6.0_02-b06 (Windows XP)
Hi Karel,
I have also encountered this issue, for the deletions of one record.
controller.deleteRecord() returning false and doesn’t deleting the record.
But, when I reducing my Foundset to the same(want to delete) record and execute controller.deleteAllRecord(), It is working perefectly…
Latter, I found It is due to the relationship.
I have maintained the M:N relationship with the Table “A” & “B”, by using one Intermediate Table “rel_A_to_B” and want to delete the record from the “rel_A_to_B”, table by using controller.deleteRecord().
ars:
But, when I reducing my Foundset to the same(want to delete) record and execute controller.deleteAllRecord(), It is working perefectly…
Latter, I found It is due to the relationship.
I have maintained the M:N relationship with the Table “A” & “B”, by using one Intermediate Table “rel_A_to_B” and want to delete the record from the “rel_A_to_B”, table by using controller.deleteRecord().
Hi Ars,
Thanks for your reply. I can’t imagine though that Servoy stumbles over some relationship with deleting a record.
controller.deleteRecord() should always work no matter what…
Creating a new foundset to do this ‘simple’ action is not an option for me…
YEAH! Found the issue thanks to Patrick Ruhsert:
One of the relations that point to organisations does not have that checkbox “Allow parent delete when having related records”.
This caused the record from being deleted.
Ars, you were thinking in the right direction…
Btw, I can’t find any documentation in the Servoy help about the option:
“Allow parent delete when having related records”
Maybe I didn’t noticed it, but could this be added in the manual in topic ‘Creating new relations’?
I reported some time ago already a bug that onDelete no errormessage (or exception is triggered). Here is the reply from Servoy:
Hello,
We will change the behaviour of record deletion in Servoy release 4.
From that release on, when delete fails because of Servoy-application errors (like AllowParentDeleteWhenHavingRelatedRecords), a ServoyException will be thrown that can be be handled in scripting.
Unfortunately, we cannot port this to release 3.5 because this is a behaviour change.
Regards,
Servoy Support
I reported this as a bug because I saw an error in my log, deleteRecord() returned false, but I couldn’t see why the delete failed.
The delete that failed is not in the getFailedRecords()
//Get the failed records after a save
var array = databaseManager.getFailedRecords()
for( var i = 0 ; i < array.length ; i++ ) {
var record = array[i];
plugins.dialogs.showErrorDialog( "error", record.exception, "ok"); }
so this way you don’t know anything (no dialog is shown).
But in my serverlog, I have found the following entry:
Delete not granted due to AllowParentDeleteWhenHavingRelatedRecords size: 3 from record with PK: 2.53; index in foundset: 0
So in case you’re searching for the reason, check your serverlog.
Rest assured Karel that all of us had an extra hour or two added onto our development time at one point or another trying to puzzle this one out!
Stupid checkbox buried on a modal dialog box for one relationship out of dozens of possibilities…grrr. a pain to find even when you do know what the problem is.