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.

Show zero or blank when no records are found

Featured Replies

I’m putting together a series of scripts to do finds for various criteria. The end result is a bunch of summaries and calculations that go into a mess of global fields for storage to be exported for a scorecard. Everything works just wonderfully unless there are no records found for a specific search, at that point that field will show the previous find results. My problem is that I need to have “zero” or a blank field or the previous number erased when no records are found.

Some of the other members may have a better solution for you, but you might want to (if you have IF functions) put an

Else

Omit Record

step in there. When the script is done, it will show 0 records if none fit the criteria.

Oh yeah. BobWeaver was kind enough to teach me this: If you are doing a loop, and want to omit records that don't match your criteria, you have to put it in like this:

Else

If [status(CurrentRecordNumber)=Status(CurrentFoundCount)]

Omit Record

Exit Loop If [1]

Else

Omit Record

Hope this helps.

Ken

  • Author

Maybe I'm putting your suggestion in the wrong spot of the script (I put it just after the find and before it's puts in the global field) but, the results come out the same. I've tried it with and with out the loop with no difference.:

Yeah, it only pertains if you have a calculation in an If function. If you use this method, it could look something like this...

Go to Record/Request/Page [First]

Loop

If ["Calculation"]

Operations you want to happen

Go to Record/Request/Page [Exit after last, next]

Else

If [status(CurrentRecordNumber)=Status(CurrentFoundCount)]

Omit Record

Exit Loop If [1]

Else

Omit Record

End If

End If

End Loop

It would be best if you could post an example script of what you have. Because if it has like a Perform Find with no If function, this wouldn't work.

Perhaps some of the FM Pro gurus could step in here and help you further.

Doc,

Are you using a version of FileMaker earlier than FM 5? FM 5 and later do in fact return an empty found set. You can set a condition in your script(s) such as

If (Status(CurrentFoundSet) = 0, Set Field <x>, 0

Or did I misunderstand the problem?

Oh, yeah, thats right. That seems the most logical.

Just a quick addition to what Kenneth2k1 said:

Remember Filmaker’s ability to capture errors in scripts. Using the status CurrentError 401 you can also capture empty find results: This is an example straight out of the FM help file just as one example:

Set Error Capture [On]

Perform Find [Restore]

Set Field ["global field", "Status (CurrentError)"]

If ["global field <> 0"]

If["global field = 401"]

Create New Record/Request

Else

If["global field = 100"]

Open ["another file"]

End If

End If

End If

I find the error capture function especially useful for testing scripts. In your case it would look something like this:

Set Error Capture [On]

Perform Find

If [status CurrentError = 401]

Set Field ["global field", 0]

End If

Just food for thought –

Rigsby

  • Author

Thanks Kenneth for your prompt reply yesterday.

I have tried all of the suggested items and Moon wins the cigar!

Moon, I do have FM5 and I don't show zero's in the summary fields (strange huh?)

Thanks...you guys are the greatest!

[ October 11, 2001: Message edited by: DocDeb ]

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.