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.

Deleting records in a loop

Featured Replies

I'm having problems with a script I have. In my 'significant other' file, I allow the users to enter/edit significant other information. I have an 'ok' button which takes them back to a layout in another file. It also runs a script to go to the perpetrator master file.

The script in the perpetrator master file is supposed to delete all the related records (related to the significant other file based on a field called Case ID). After it deletes the records, it goes back to the perp master file and enters the new information if the 'Perpetrator' field in the significant other file is set to something other than 'N/A'. I'm doing this because anytime someone would mistakenly flag someone as a perp if they aren't really a perp, or edit their name/address/ssn/whatever else. This should keep all the data as current as possible.

Now the problems that I'm having are in the perp master field. It seems no matter how I make my script go, it leaves one of the perps behind from that last update. Breifly, my script is:

In Sig other:

....

- Go to related record (Based on the CaseID relationship, this should bring up the current related files in the perp master?)

- Run external script (in perp master to remove the files)

....

In Perp master:

- Go to Record/Request (First)

- Loop

- Delete Record/Request

- Goto Record/Request (Next, Exist after last)

- End Loop

That's basically all I have, is there a way that I can just delete all related records? I tried the delete all records command, but that didn't delete just the related records, it did all the records in the file.

  • Author

I think I fixed it. For some reason I had the 'Show only related record' checkbox marked on the Go to related record command. I didn't even know what it did, but I couldn't get it to work before so I thought I'd check it.

Now all the script in the perp database contains now is 'delete all records', it seems to work fine.

Remember, if you don't use the "show" option, the found set can contain an indeterminate number of records. If you want to isolate a set of related records you need to use the show option. If you use this option, a delete all records is the way to go.

The reason the looping delete didn't work is found in watching the prgression of the current record pointer. If you go to the first record and delete it, you are now on the second record. If you then go to the next record and loop, you are on the third record, having skipped the second. You then delete the third record, landing on the fourth, and skip to the fifth. Using this method you don't delete any of the even records, NOT ALL OF THE FOUND RECORDS!

-bd

That's basically all I have, is there a way that I can just delete all related records? I tried the delete all records command, but that didn't delete just the related records, it did all the records in the file.

Try with:

Go to related record, SHOW

Perform script in target file

Delete All records

  • Author

Thanks guys, you're right. So the 'Show only record' thing shows JUST the related records, then? I just realized the same thing this morning after I tried it, and after I was done swearing I thought I'd come back here and check up.

LiveOak - thanks for the explination, I figured it was something strange like that.

Thanks again, guys!

Create an account or sign in to comment

Important Information

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

Account

Navigation

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.