Searching all fields
Is there a way to search all fields in a layout in one go?
Nevermind. I think I figured out why. One of the finds was asking it to look in a different table as I have a related field that I would have liked it to have searched as well but I removed it and it seems to be running smoothly now.
Thanks so much.
Thanks the find and replace worked but is there a way to search all the fields in one layout that can then be saved as a find? For example the database I use is for a museum collection so I want to look for a guy whose name is Ben Carter. He could be in numerous fields (he would be in the donor field, history field and maybe even the description field) as well as in many of the records. So I want to be able to type Ben Carter in and have the database search the entire table regardless of what field the result sits in and then pull up all those records for me so that I may scroll through them as well as savve it the find.
Another alternative, (now that you've posted a more detailed description of the issue), is to write a script:
Have the user enter the name in a global field.
In your script:
Enter Find Mode
Set field [yourtable::field1, Yourtable::GlobalField]
Set Ffield [yourtable::Field2, Yourtable::globalField]
//repeat for each field you want to include in your search.
Set Error Capture [on]
Set Error capture [off]
I played around with your suggestion but I think I need a little more coaxing as I have never written a script before. Right now I am trying to write it by setting up a button which opens the Button set up menu - is this where I want to be? I then click enter find mode and from there I am kind of lost. Do I then click set field and it saves the enter find mode bit? And then do I click the specify button?
Or should I be writing the script in another place?
You'll need to start from Manage Scripts... in the Scripts menu. You'll see a button for creating a new script. Click that and you'll get an editor for building a script. You can double click a script step on the left hand list to add it to your script and then click other controls that appear along the bottom of the dialog to customize the script step.
Since you haven't done this before, you might want to read up on it first. Bring up filemaker's help system and look up "Planning a script" and "creating and editing scripts" if you want to learn more that way.
Ok I think I am slowly starting to get it. This where I catch a snap
Set field [yourtable::field1, Yourtable::GlobalField]
Set field [yourtable::field1]
now how do get this bit - Yourtable::GlobalField- into there?
Great. Thanks. Ok I think I am almost there. I have written the script, now how do I make it a button so I can test it out?
Try all of the following in layout mode...
In the tool bar at the top, there's a button for adding a button to your layout. It shows an icon of a hand and a button. Click it and then "draw" a rectangle on your screen to show the size and location of where you want your new button. Filemaker will walk you through the steps from there.
If you want to make an existing layout object a button (nearly any layout object--including text and data fields can be set up as a button), select the object and choose Format | Button Setup...
Great, I figured how to make the button but I think the script is only half working as it seems to be able to find what I ask but not in the way I want. In other words, I have 409 records in total and when I type a name in the global field it will then go to a record with that name but there are still 409 records in the find. Did I miss a step?
This is an abbreviation of my Script:
Set field [COLLECTIONS l FONDS::Collections l Fonds_Part_of; COLLECTIONS l FONDS::Global_Field]
Set field [COLLECTIONS l FONDS::Collections l Fonds_Title; COLLECTIONS l FONDS::Global_Field]
Set field [COLLECTIONS l FONDS::Collections l Fonds_Series; COLLECTIONS l FONDS::Global_Field]
Basic script looks correct, but it may not be producing the results you expect.
Some issues to consider:
If you enter "Apple" in your global field, the script will find
Thus, it may match more records than you expect.
Even if it is not on the layout.
However, be sure to understand how this works.
If you put search criteria in a field from a related table, you are still searching the layout's specified table for records. You are telling filemaker: "Find all records from the layout table where these records have a related record that match this value."
PhilModJunk wrote:Global_Field must be set up with Global Storage (See field options in Manage | Database | Fields). If it's not global this script, I think, will find all records. I'm unsure why you would say this. A non-global won't retain its value once you enter find mode (it blanks out) so the value would disappear. You would be setting the field to search to an empty value and it would tell you (if you don't have Error Capture on) that you have no valid find criteria. If you DO have error capture on, it will simply return you to your prior found set like any failed find. Is this what you mean, Phil? :smileyhappy:
Global_Field must be set up with Global Storage (See field options in Manage | Database | Fields). If it's not global this script, I think, will find all records.
I'm unsure why you would say this. A non-global won't retain its value once you enter find mode (it blanks out) so the value would disappear. You would be setting the field to search to an empty value and it would tell you (if you don't have Error Capture on) that you have no valid find criteria. If you DO have error capture on, it will simply return you to your prior found set like any failed find. Is this what you mean, Phil? :smileyhappy:
I was predicting what might happen without testing to see. :smileywink: I thought it might work like a find all since no criteria was entered and error capture was turned on. If not, I stand corrected.
In either case, the script will not produce the expected results if it's not a global field.
I figured that's what you meant. But there is big difference between a find failing and returning someone to their prior found set and 'finding' all records.
thought it might work like a find all since no criteria was entered and error capture was turned on. If not, I stand corrected.
You do. Stand corrected then. It is important that people understand that difference. Predicting without testing probably isn't good practice. People read things here and take them for fact.
Given the context of this thread and the phrasing of my reply, I choose to disagree.
What I actually said: "If it's not global this script, I think, will find all records."
As I said before, I stand corrected.
Then we'll agree to disagree. Honestly, I was looking to help - not make you irritated. Any designer who has used this program for more than six months knows that a value in a non-global field will disappear in find mode and can't be used. You need to put that value into a variable or a global. And most designers also know that if there is no find criteria, the search will fail and return to prior set.
As I said before, I was trying to help because others might want to understand what you don't yet understand about finds.
Retrieving data ...