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.

Close Script

Featured Replies

I need to write a close script to find all the blank records and delete them upon closing,

I wrote a script to find the blanks in a field but when the field is already blank it trys to delete the entire data base is there a way to do this.

Thanks in advance.

Randy

When you say "already blank" I presume you mean it's empty in all records. Doesn't the script give you an error dialog? You need to trap for errors. E.g.:)

Set error capture[On]

Find[...]

If[Get ( FoundCount ) = 0]

. Exit script // or whatever

End If

or...

If [Get (LastError) <> 0]

or...

If [Get (LastError) = 401]

  • Author

Ok so I did this script

Set Error capture [on]

Enter Find mode Restore

perform find

if Get(FoundCount)=0

Close File[Current File]

end if

if Get(FoundCount)>0

Delete All Records[no dialog]

Close File[Current File]

end if

It cycle into a loop on exit and deletes records.

What is going wrong???

Thanks

A couple of points:

1) The loop happens because you invoke Close File in the script, which is itself invoked by closing the file. I'm not certain, but you probably don't need to Close File in the script since it's already the action taking place.

2) You can simplify the script to:

Set Error Capture[On]

Perform Find[Restore]

/* Note: I don't like using the Restore option in finds, since I can never get them to work; I always end up coding my finds using Set Fields... */

If[Get(FoundCount)]

Delete All Record[No Dialog]

End If

You don't need to test for FoundCount=0 since all you're doing is closing the file, which as I noted above, is the action taking place anyway.

HTH,

David

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.