Jump to content

Clear all previous Finds


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

Recommended Posts

Hi.

I would like to have a Find button on my solution that will prefrom a find, that will NOT look at the previous found set.

For example the first time a ran a find on all new records I typed in "first name" in that field & it found that record, however the next time I did a find it didnt give me an option to type in a frist name, it just fount the record from the 1ast time I used find. How can I make the find button clear all previous finds, then ask me "what to find"? (using that 1 button)

What I really need is to add the Continue Button (Continue (a button created by FileMaker Pro in the status area) to my Find Button. But I don't know how.

Thanks again.

Kicker

Link to comment
Share on other sites

You need to make your Find button run a script. Also, you should make a global field for the user to enter find criteria. The script would Enter Find Mode (Restore OFF), then Set the field being searched on (first name, for example) to the contents of the global entry field. Then it Performs the find (restore OFF), and resets the global field to empty.

In general, any find operation always works on the whole database, not just the previous found set. I'm not sure what you have attached to your button, if it is a script similar to the above, you probably have the restore options clicked ON with the Enter Find Mode and/or Perform Find script steps. This will make your script ignore whatever you want it to find, and find whatever it was that someone most recently ran a find on.

Steve Brown

Link to comment
Share on other sites

Kicker:

Before your Enter Find Mode step, add:

Show All Records

This will ensure that your find will search the whole database.

-Stanley

Link to comment
Share on other sites

Kicker:

That is a good idea. I try to keep the status area hidden from the user as much as possible. Your button would be defined to "Resume Script" and that's it. You can also put up some text on your find layout that says "type in your search criteria, then hit 'enter' to continue", because that works, too.

-Stanley

Link to comment
Share on other sites

Unless you're using Contstrain or Extend Found Set, it shouldn't matter if you Show All Records before performing a find, because a find operates independently of the found set. It sounds like something else is going on here.

Link to comment
Share on other sites

Kicker:

No. Your find button launches the script. Your new button just resumes the script. You'll want to create a duplicate of your layout, remove the "find" button, and put in a resume button. Your script would now look like:

Go To Layout [your new layout]

Show All Records

Enter Find Mode [pause]

Perform Find []

Go To Layout [original layout]

And while it's true that the find should search the entire db anyway, I've always put Show All Records before a find, just out of habit.

-Stanley

Link to comment
Share on other sites

Back on the original issue, Queue is correct. You do not need a Show All Records step, because a find will always work on all records, regardless of what found set you have at the time you run the script.

You say this is your script:

Go To Layout [your new layout]

Show All Records

Enter Find Mode [pause]

Perform Find []

Go To Layout [original layout]

If this is your whole script, you haven't told the script what to find. Open the script again in Scriptmaker. Highlight the Enter Find Mode step. Is the little box at the bottom of the window labelled "restore" checked or unchecked? Do the same with the Perform Find script step.

If either or both have "restore" checked, your script is running a memorized find. If not, it doesn't know what to find.

I'd make a global text field, call it g_Search, and place it in the layout for the user to enter what they need to find. If they are searching for, say, a name, then your script becomes:

Go To Layout [your new layout]

Enter Find Mode [pause] ***Restore UNchecked***

Set Field(LastName, g_Search)

Perform Find ***Restore UNchecked***

Set Field(g_Search, "")

Go To Layout [original layout]

This will make the script try to find matching records between the info the user put in the global g_Search field and the LastName field (it also clears the g_Search field after the Perform Find).

The beauty of this is that if you learn that your data can have the name in the FirstName field, you just add steps to the script to search both fields:

Go To Layout [your new layout]

Enter Find Mode [pause] ***Restore UNchecked***

Set Field(LastName, g_Search)

New Record/Request

Set Field(FirstName, g_Search)

Perform Find ***Restore UNchecked***

Set Field(g_Search, "")

Go To Layout [original layout]

And so on. In scripting complex searches, I've found this is far easier to alter or debug than memorizing a find. I have a database with a global search field combined with a "go" button running one of these scripts that is simultaneously searching 23 fields, with 23 find requests. I can easily add or subtract a field or two from the script, but it would be a monumental hassle to carefully set up a manual find and memorize it.

Steve Brown

Link to comment
Share on other sites

Oh. Okay, though it sounds like he's is giving a dangerous amount of control to the user.

Couldn't you do away with the pause by breaking it into two scripts? The first script just Enters Find Mode and stops. Now the user is in Find, on the needed layout, and fills in the fields needed. You could make a "Go" button that runs a script that starts with Perform Find.

Can you click a button and run a script while in Find Mode? I've never tried to do that.

Steve Brown

Link to comment
Share on other sites

Yes, you could break it into two. I often make the first one

Enter Find Mode [Pause]

Perform Script [Continue Find]

and use a button on the layout that merely Resumes the script. I think it's cleaner than completely divorcing the two, but depeding on one's purposes, it may be more useful to just Enter Find Mode and have a button to trigger a separate script.

Link to comment
Share on other sites

This topic is 7023 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
×
×
  • Create New...

Important Information

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