Can't get deleteRecord to work

I think I have a relation problem, preventing me from deleting a record. I’ve tried to find answers before posting, but I’m stuck.

I don’t see any errors in the logs, when looking at the Admin console.

I wasn’t getting any errors when running this code:
“forms.Add_a_book.foundset.deleteRecord(row)”

I am setting “row” properly and have verified I have the right row.
It passes right through the deleteRecord line without any complaints, but the row never gets deleted.

I read a bunch of posts about needing to turn on the checkboxes in the relations. I turned them all on for all my relations, trying to troubleshoot this, but here’s the message I’m getting now:

com.servoy.j2db.dataprocessing.DataException: DELETE statement conflicted with COLUMN REFERENCE constraint ‘fk_package_lookup_child_item’. The conflict occurred in database ‘OSBDB2’, table ‘PACKAGE_LOOKUP’, column ‘item_child’.
org.mozilla.javascript.JavaScriptException: com.servoy.j2db.dataprocessing.DataException: DELETE statement conflicted with COLUMN REFERENCE constraint ‘fk_package_lookup_child_item’. The conflict occurred in database ‘OSBDB2’, table ‘PACKAGE_LOOKUP’, column ‘item_child’.

I created a new form with just this table and it still give me these errors.

I checked my security and I’m logged in as admin.
I checked the database and I can delete records with SQL directly.
I don’t have any other methods running anywhere.

I think the problem is with the relations somewhere, but I just can’t figure it out.

I have relations between 3 tables:

packages to package_lookup
packages to items
package_lookup to items

An item can be a package.
If it is a package, there will be a record in packages.
Package_lookup is the join table that has a record for each component item in the package, along with the package_id.

I’m trying to build a screen that let’s me delete a component record out of the package_lookup table. Everything works, except the final deleteRecord call.

HELP!!

Hi Jason,

Did you check your relationship ‘fk_package_lookup_child_item’ in Servoy to see if you have checked ‘Allow Parent Delete’ and/or ‘Delete Related Records’. If those are not checked then deletion might not happen.
Your error refers to that.

Hope this helps.

Yes, I have checked every box (all 3) on each and every relationship. There’s one that caused this error when I turned it on. I can get it to go away if I turn off the checkbox, but then my deleteRecord still doesn’t work.

I must be missing something in the proper setup of this. I’ve been staring at it for hours and can’t make it work.

Ok, I figured it out.

I was shotgunning the troubleshooting because I was tired after working on this all night. I took a break, came back 6 hours later, and it came to me.

I checked all the checkboxes in the relations for deleting parent records, related records, etc. After I clicked all 3 on for every relation I had, I started getting that weird CONFLICT message above.

When my brain returned today, I realized that I didn’t want to delete related records. So I went through and turned off the checkbox on every relation for the bottom checkbox and voila! My error went away and deleteRecord starting working instantly.

Thanks for listening. Maybe this post will help someone else someday.