how to catch search problem?

I got a search in filemaker with a script.

But sometimes the # of found records is 0. I want filemaker no to give a messagebox like:

"No records has been found"

[Cancel] [Continue] [Edit search]

Or so, i got the dutch version, don't know what the english version mentions.

But anyway, I want filemaker not to mention that (like catch the error or so) and i want to give my own messagebox. Any ideas???
DucoloAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lieven EmbrechtsSenior IT ConsultantCommented:
Here's a sample of what you can do.
The trick is to Set Error Capture On and Off and check on Get(FoundCount)=0


Set Error Capture [ On ]
If [ Get(WindowMode) = 0 ]
   #We're in Browse Mode: Enter Find Mode
   Enter Find Mode [ ]
   [ Pause ]
Else
   #We're already in Find Mode. Let the Find button function the same as the Continue button.
End If
Perform Find [ ]
If [ Get( LastError) = 400 ]
   Show Custom Dialog [ Title: "Message"; Message: "No find criteria were entered. All records will be displayed."; Buttons: "OK" ]
   Show All Records
Else If [ Get(FoundCount)=0 ]
   Show Custom Dialog [ Title: "Message"; Message: "No records match this request."; Buttons: "OK" ]
   Show All Records
Else If [ Get(FoundCount)=1 ]
   Go to Layout [ original layout ]
Else
   Go to Layout [ "List View" (Employee) ]
End If


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lesouefCommented:
the last line should be
Else If [ Get(FoundCount)>0 ]
according to me...
no big difference  I agree!
0
lesouefCommented:
I forgot to mention that to simplify what Lieven described, if you set capture on, no more error msg from FM, and that's true for all functions; then you have to test for errors right after the search to display whatever you want; after a search, the simplest is to count the amount of found records of course
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Lieven EmbrechtsSenior IT ConsultantCommented:
> the last line should be
> Else If [ Get(FoundCount)>0 ]

Incorrect, you didn't see the else.
When = 1 it jumps to the 1 record layout,
else it jumps to the list view.

> I forgot to mention that to simplify what Lieven described, if you set capture on, no more error msg from FM,
> and that's true for all functions; then you have to test for errors right after the search to display whatever
> you want; after a search, the simplest is to count the amount of found records of course

yes, that's what i said: "The trick is to Set Error Capture On and Off and check on Get(FoundCount)=0"
0
lesouefCommented:
ouppsss, was late.... sorry.
by the way ducolo is a long time user, strange to see him asking this....
0
Lieven EmbrechtsSenior IT ConsultantCommented:
yup, i simply had to open a template, print to pdf, copy/paste.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FileMaker Pro

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.