Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Cascading delete won't delete!

Featured Replies

Grrr!

I have a database that stores virtual information for paginating a newspaper. The structure goes like this:

One Issue to Many Pages

One Page to Many Foreign Items (info on stuff that was put on the page before the database examines it)

One Page to Many Gaps (Blank spaces on the page)

Now, here's the problem. In the Issue DB, if I delete a page, it deletes all of its foreign items records, but not all its gaps. The two are related in the same fashion, and the relationship to Gaps is valid. Both have the 'delete related records' box checked in relationships. Nonetheless, no error, nothin, just a whole bunch of orphan Gaps. Thoughts? Feelings?

My thought is that FM just doesn't cascade that way. I've never tried it myself.

I feel like this is a bad thing.

You might have to do the delete by script.

in the page db, use the show related records (only related) then delete that found set.

It can delete this way. I've emptied whole database like this... try it with a self-join some time.

If any records are left over they could be orphans or some incorrectly-related records.

  • Author

I know it works! Like I said, it deletes all the records related in the foreign items database! I knwo they're related, cause they show up in a portal.... no other ideas?

Silly question:

Are you deleting an Issue or a Page? If you're deleting an Issue, there may be an issue (pun? what pun?) with a second-level relationship.

Not saying this is the answer, but it might help to find the answer.

  • Author

Yes, I'm deleting an issue. What's the issue with second level relationships? I mean, if the issue deletes the page, won't the page delete the gaps?

If you are relying on FMP to "cascade" delete, ie. by virtue of relationship that allows deletion of related records then this must ne initiated in the "master" file.

I suspect that your second relational delete fails because you have already deleted the original master record by initiating the delete record command in the master file to delete the first relational set.

I also recently tested a recursive delete based on relationships - but that does not work. Seems that FMP will only delete related records from one level down.

Here's the workaround

Script roughly as ???

Master file:

GoTo Related records (show only related record)

Perform script (external) [as below]

Related file

Delete All Records

You can then retain the master record for continued deletion sets by related set. Bear in mind you need to move onto each related set in the GoTo Related recs command.

  • Author

Ah... I see... well, that's illuminating. It still bugs me that the one related database deletes its objects and the other doesn't, but I'm sure there's something I'm missing. Thanks for the thorough answer!

  • Author

Well, I tried what you said, it didn't work. So, as an experiment, I went to the pages database, and deleted a record manually. No dice, still didn't delete the records. The gaps display in a portal on the very page I'm deleting from, so I know they're related correctly. The checkbox for cascading deletes is checked in the relationship properties. Its, like I said, virtually identical to the Foreign Items link in every respect. And yet....

Grr!!!

Other ideas?

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.