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.

Finding Null Records

Featured Replies

Have a script that (or hopefully will have) that performs a search automatically on user opening a file. If their user name and current date already exist in a particular field, then the script goes to that record, which they will then amend. If the search returns no results then a new record is created.

How do I get a script step to say, "if no records found do x" and also how do I get the the dialogue for no records match this set to NOT appear.

Thanks.

How do I get a script step to say, "if no records found do x" and also how do I get the the dialogue for no records match this set to NOT appear.

The clue here is to use Set Error Capture to ON in your script. Error capture remains in effect until you do a Set Error Capture [OFF] or the script terminates, or passes to another script.

When error capture is on then you have control in the script. You must test for the last error using Get(LastError). Based on the number returned (see the help system for error codes) you can then direct you script accordingly - this will also suppress the standard FM dialog box, so you could use your own custom dialog too.

You probably will end up with this structure in your script:

Set Error Capture ON

Enter Find

Set Field AccountName , Get (AccountName)

Perform Find

If (GetFoundCount) = 0

do this

Else

do this

End If

  • Author

Thanks very much gents. I've seen Set Error On many times in scripts and never saw the point to it. I do now. Problem solved.

The clue here is to use Set Error Capture to ON in your script. Error capture remains in effect until you do a Set Error Capture [OFF] or the script terminates, or passes to another script.

No. Error Capture state is passed on to all sub-scripts too.

I had a problem last week (exporting XML files from a container field) and the real problem was masked by a "Set Error Capture [on]" step in one of the dozens of scripts that the process called earlier in its running. Grrr.

My recommendation is to set error capture off after it's no longer required.

Thanks Vaughan - I stand corrected.

Personally I've always explicitly used Error capture ON in EVERY script so I would never have spotted that.

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.