noParentDeleteWithRelatedrecords - Which relation?

I have a foundset that I am trying to delete a record from and it keeps throwing !servoy.foundset.error.noParentDeleteWithRelatedrecords! . I have tried every combination of " Allow parent delete when having related records" and “Delete related records” on all the relations that could possibly be used in this found set with no results.
Is there any way to get a little more information on exactly what relation is the problem? All of the mentioned relations where all auto-created from the database foreign keys, and the deletes cascade properly in the database (MySQL) if I do it manually, just servoy wont let them happen.

I have tried 4.0.1 and 4.1b4 with the same results :(

Ryan,

The relations checked are the relations with primary table the same as the foundset table, this is the same set as shown under the relations node below a form based on the same table in developer (4).
If there is one relation that has the option ‘allow parent delete when having child records’ turned off the delete will fail with the reported error.

Note that a relation with the option ‘Delete related records’ on will cause delete of data in another table. A relation on that table could also block the delete.

Rob

Hi Rob, I think Ryan means that if it is possible that Servoy could give us the relationname that does the block!
I have had this also once, and it will cost you (in a big solution) a lot of time to found out, which relation blocks it.

I have added logging of the relation name when a delete is blocked for that reason.
Will be available in next v4 release.

Rob

That would be awesome. Thanks for clearing up what I was asking for Harjo, you where exactly right.

Has this been implemented? How can I find out which relation causes the violation? Couldn’t find it under ServoyExceptions.

Thanks,
Reto

Reto,

The log file should show something like:

Delete not granted due to AllowParentDeleteWhenHavingRelatedRecords size: 1 from record with PK: 1.3; index in foundset: 3 blocked by relation: orders_to_order_detail

In the smart client it should show up in the java webstart console when opened.

Rob

I seem to remember that this worked exactly as Rob describes. However, I have the same problem again and can’t find which relation is blocking the delete. I don’t have any information in the log file (/Servoy/application_server/servoy_log.txt) and the Console application in OS X only gives me

09.05.10 09:01:29 [0x0-0x2a02a].org.eclipse.eclipse[502] Exception Object: com.servoy.j2db.ApplicationException: !servoy.foundset.error.noParentDeleteWithRelatedrecords!
09.05.10 09:01:29 [0x0-0x2a02a].org.eclipse.eclipse[502] MSG: !servoy.foundset.error.noParentDeleteWithRelatedrecords!
09.05.10 09:01:29 [0x0-0x2a02a].org.eclipse.eclipse[502] is a ServoyException
09.05.10 09:01:29 [0x0-0x2a02a].org.eclipse.eclipse[502] Errorcode: 331

This is the same information I get in the Servoy Debug Console. In the Java Preferences I have tracing and logging enabled.
I checked all relations that involve the table in question and all of them have the option “Allow parent delete…” enabled.

What am I missing?

Thanks,
Reto

xtsr:
can’t find which relation is blocking the delete

I’m sure there must be one…
If you can use the SolutionModel, why don’t make things easier?
Just write a piece of code that scans all your relations and their settings.
Filter out the ones that can bug you and then check for ‘related records’.
5 minutes of work, years of fun! :-)