1 2 Previous Next 22 Replies Latest reply on Nov 6, 2009 1:26 PM by mrvodka

    Searching all fields

    AlexisJensen

      Title

      Searching all fields

      Post

      Is there a way to search all fields in a layout in one go? 

       

        • 1. Re: Searching all fields
          DLW-BPEX
             More information will be helpful. Are all the fields of the same type? What will you be searching for? What is it you are trying to do?
          • 2. Re: Searching all fields
            philmodjunk
               Check out Find/Replace in the edit menu and see if it will do what you need. (This option can also be used in a script.)
            • 3. Re: Searching all fields
              AlexisJensen
                

              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.

               

               

              • 4. Re: Searching all fields
                philmodjunk
                  

                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]

                New Record/Request

                Set Ffield [yourtable::Field2, Yourtable::globalField]

                //repeat for each field you want to include in your search.

                 

                Set Error Capture [on]

                Perform Find[]

                Set Error capture [off]

                 

                 

                • 6. Re: Searching all fields
                  AlexisJensen
                    

                  Hi

                   

                  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? 

                   

                  Thanks,

                   

                  A<!-- Session data -->
                  • 7. Re: Searching all fields
                    philmodjunk
                      

                    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.

                    • 8. Re: Searching all fields
                      AlexisJensen
                        

                      Ok I think I am slowly starting to get it. This where I catch a snap

                       

                      Set field [yourtable::field1, Yourtable::GlobalField]  

                       

                       I have

                       

                      Set field [yourtable::field1]

                       

                      now how do get this bit - Yourtable::GlobalField- into there? 

                      • 9. Re: Searching all fields
                        philmodjunk
                           Click this script step in your script. You'll see two Specify... button in the bottom right corner. Click the second Specify... button and enter your expression. (Don't enter the ; filemaker will put that in for you. )
                        • 10. Re: Searching all fields
                          AlexisJensen
                            

                          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?

                           

                           

                          A

                           

                           

                          • 11. Re: Searching all fields
                            philmodjunk
                              

                            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...

                            • 12. Re: Searching all fields
                              AlexisJensen
                                

                              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:

                               

                              Enter Find Mode[]

                              Set field [COLLECTIONS l FONDS::Collections l Fonds_Part_of; COLLECTIONS l FONDS::Global_Field]

                              New Record/Request

                              Set field [COLLECTIONS l FONDS::Collections l Fonds_Title; COLLECTIONS l FONDS::Global_Field]

                              New Record/Request

                              Set field [COLLECTIONS l FONDS::Collections l Fonds_Series; COLLECTIONS l FONDS::Global_Field]

                              Set Error Capture [on]

                              Perform Find[]

                              Set Error capture [off]

                              <!-- Session data -->
                              • 13. Re: Searching all fields
                                AlexisJensen
                                  

                                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.  

                                 

                                A

                                • 14. Re: Searching all fields
                                  philmodjunk
                                    

                                  Basic script looks correct, but it may not be producing the results you expect.

                                   

                                  Some issues to consider:

                                  1. The new record/request step makes this an "OR" search. "Find all records where the global field text can be found in Fonds_Part_of OR Fonds_Title OR Fonds_Series"
                                  2. 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.
                                  3. As written the text in global field only needs to be contained somwhere in the fields being searched.

                                  If you enter "Apple" in your global field, the script will find

                                  Apple

                                  Green Apple

                                  Apples

                                   

                                  Thus, it may match more records than you expect.

                                  1 2 Previous Next