Skip 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.

find script target is not in related table

Featured Replies

  • Newbies

In a new database< i have 20 tables, none linked with any other at this point. I am cleaning them up to delete blank rows. I can do this by hand: go to layout "Single", say, click on find mode, enter an = in a field, click find, and delete records in the found set. However, a simple script to do this usually hits the error, "The operation could not be completed because the target is not part of a related table." I say usually because once in a while it works! Anyway, the script is simply:

Go to layout[single"]

Enter find mode[]

Perform find[Restore] ... note below

Delete all records[]

note, the script for perform find has the specifiy find requests checked, which is where I have action as Find records amnd criteria Record =.

Advice?

More than likely one of your perform finds with restored criteria is referencing a table of which your layout is not based on.

Also you dont need the enter find mode step if you have a stored find.

Furthermore, you really should have a check to see if it returns any found records mataching your criteria before you delete the records.

It appears you are looking to find blank records and then delete them. If there are multiple tables is there a common field name, e.g. "UserID?

If not, how do you select the correct field to search?

Your script would be more accurate if you used:

Enter Find Mode() //uncheck Pause

Set Field(FlagField; "=")

Perform Find()

Delete All Records //This makes me very antsy So I hope you have a backup before you do this?

Conversely, you could place a Button with a script parameter on each layout and make sure you are referencing the right field for the right table layout.

Set Variable($Parameter;Get(LayoutName)

If ($Parameter = Table A)

Go To Layout($Parameter)

Enter Find Mode()

Set Field (TableA::Flagfield; "=")

Perform Find()

Delete All Records //Again, make sure you have a back up

EndIf

Obviously, you need to create a separate IF statement for each layout.

Usually, when I do this kind of clean up I run a loop and set a Flag like Set Field(Delete,"Yes")

Then look at my data to just make sure it is what I want before I push the "KILL" button.

But, that's me, I paranoid. :o

***************************************

Good Point John.

Set Variable($Parameter;Get(LayoutName)

If ($Parameter = Table A)

Go To Layout($Parameter)

Enter Find Mode()

Set Field (TableA::Flagfield; "=")

Perform Find()

If Get(lasterror = 0)

Delete All Records

//Again, make sure you have a back up

Else

Show Custom Dialog(No Records Found)

Endif

EndIf

****************

Also, my scripts almost always need tweaking!

Edited by Guest

  • Author
  • Newbies

Thanks! Using your suggestions, the script works now. Yes, it's dangerous, I wrecked probably a dozen copies of the database working on the script, so I definitely need to add some safeties!

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.