Jump to content

Find error dialogue box


This topic is 2888 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi Folks,

I've got a couple of search boxes on the home page which all work fine. When there are no results, I have no problem leaving find mode and returning back to the original layout, but this could cause jitters for my colleagues.

 

I've attempted to set up a way to trigger a custom dialogue if that happens, but I've never done this before and can't get it to work.

I can see problems with the attempt below but have brain fade in fixing it! I think I need to use something like:

 

  • If FoundCount=0
  • then goto dialogue box
  • Else exit script?
Enter Find Mode [ ]
Go to Layout [ “Pupils” (Pupils) ]
Set Field [ Pupils::FullName; Pupils::gPupilFind ] Set Error Capture [ On ]
If[Get(FoundCount) =0]
Perform Find [ ]
Go to Layout [ original layout ]
Show Custom Dialog [ Title: "No matches"; Message: "No matches found for " & Quote ( Pupils::gPupilFind); Default Button: “OK”, Commit: “No”; Input #1: Pupils::gPupilFind, "Find:" ]
End If

A nice touch would be the ability to alter the find string from the dialogue box and search again..

 

Many thanks,

Mike

Link to comment
Share on other sites

Get (FoundCount) while still in find mode returns the number of existing find requests so the perform find, Go to layout, Show custom dialog script steps will never execute in your version.

 

My guess is that you want to

Enter Find Mode [ ]
Go to Layout [ Pupils (Pupils) ]
Set Field [ Pupils::FullName; Pupils::gPupilFind ]

Set Error Capture [ On ]
Perform Find [ ]

Set Error capture [Off]
If[Get(FoundCount) =0]

Go to Layout [ original layout ]
Show Custom Dialog [ Title: "No matches"; Message: "No matches found for " & Quote ( Pupils::gPupilFind); Default Button: OK”, Commit: No”; Input #1: Pupils::gPupilFind, "Find:" ]
End If

 

You might want to think about how you will handle the missing Else or Else If clause in your script. You have handled the case where found count is zero.. but what if found count is exactly one? What if found count is more than one? it is common to put the user into a list layout if more than one record is found and put them into the detail layout if only one record is found.

Link to comment
Share on other sites

Hi folks,

If come up with this script which works - the custom dialogue gives the option to change the search.

It's the first time I've Else / If type stuff and I'm pretty sure my loop could be simplified, (I've not done anything like this since I was a kid working with BBC Basic!!)

If anyone has improvements on my rough conditional branching I'd be grateful :-)

Enter Find Mode [ ]
Go to Layout [ “Pupil List” (Pupils) ]
Set Field [ Pupils::FullName; Pupils::gPupilFind ] Set Error Capture [ On ]
Perform Find [ ]
Set Error Capture [ Off ]
If[Get(FoundCount) =0]
Go to Layout [ original layout ]
Show Custom Dialog [ Title: "No matches"; Message: "No matches found for " & Quote ( Pupils::gPupilFind); Default Button: “OK”, Commit: “No”; Button 2: “Look again”, Commit:
“Yes”; Input #1: Pupils::gPupilFind, "Enter new search:" ] If [ Get ( LastMessageChoice ) =2 ]
Perform Script [ “Find Pupil” ] End If
End If
Link to comment
Share on other sites

This topic is 2888 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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