8 Replies Latest reply on Nov 17, 2016 10:47 AM by philmodjunk

    Make a search script that search all post and field


      I like the fm toolbar and the search field it has. There I can type anything and get a result were I find that search string in all of my post.


      Now, I want to do a own search field and have the same thing happened. Obvious it's doable but how? Have tried a litle script and made one global field but can't find out how to do it. Thinking I'm not on right track.

        • 1. Re: Make a search script that search all post and field

          A global field with script can replicate the quick find box at top right of the standard FileMaker toolbar.


          Since this didn't work for you, I suggest that you:


          a) share your script

          b) describe exactly how it didn't work for you.


          To post a script, you can:


          1. Post a screen shot of it using the picture tool, or
          2. Use FileMaker advanced to generate a Database Design Report and copy/paste the text from it to the forum, or
          3. Print the Script to a PDF and copy/paste the text from there, or
          4. Click the advanced editor option at top right and attach a FileMaker file with the script that doesn't work


          PS. I rarely find a use for quick find in my own solutions. Each field in a record should be set up to store a specific type of information and thus, each search criterion need only be specified in a particular field defined for that type of information. Thus, searching other fields that would never hold that particular type of info simply slows down the search.

          • 2. Re: Make a search script that search all post and field


            Have tried many different script. This is what I am now. Not much. Also tried Find/Replace. Stil don't get it.

            • 3. Re: Make a search script that search all post and field

              Find Matching Records does not perform a Quick Find. It performs a find for all records that have the same value in the specified field as that found in this field on the current record. If you specify a global field, this won't work as all records in your table will have the same value in a global field


              An example of how you would use this is if you have a bunch of records in a table and the current record has 11/8/2016 in a date field. Find Matching Records enables you to find all records in your table that also has 11/8/2016 in that one date field.


              You want this script step:


              Perform Quick Find [ YourTable::YourGlobalFieldHere ]


              Note that quick find searches for the specified criteria in all fields on the current layout where quick find searching has been allowed via a setting on the Inspector's Data tab.

              • 4. Re: Make a search script that search all post and field

                But if I replace the Find matching records with the Preform Quick Find, no different things happened. It search and take 2-5 second. By database is local and only 2000 post.


                When I use the search in fm toolbar it take <1 sec and show only the found records were the search string apply (in all fields). That is what I want here.

                • 5. Re: Make a search script that search all post and field

                  If you just want the search option you can do a script that calls "Enter find mode" but am guessing you dont want that =)


                  I done a simular one, but only an option of field to search in. i called it quick search.

                  I basicly did a IF statement that checks what value the quicksearch field had and then the search script inside each instance.

                  This is one of my quick seach scripts:



                  Am not a pro user. so dont mind my badly typed script =) but it might give you an idea if this is something simular that you want to do.

                  • 6. Re: Make a search script that search all post and field

                    Perform Quick Find should produce identical results to entering criteria into the quick find field.


                    If it doesn't, it suggests that there is some difference here between your script and how you are using the quick find field in the status bar.


                    Keep in mind that


                    Perform Quick Find [ Table::field ]


                    Is using Table::Field in place of the quick find field in status bar. It's the data in that field that is being used to perform the quick find.

                    • 7. Re: Make a search script that search all post and field

                      Now I see that you only need the quick find step and that is the same as using fm toolbars own quick find.


                      I found out that something happened when I search. It takes a long time and have only 2000 records. Don't know why that happens. Can it be Mysql script? My solution is on a server. Even if I search for a specific word I get all my post as result but the word is not in every post?? Strange...

                      • 8. Re: Make a search script that search all post and field

                        There are a number of factors here that can affect how fast a response is produced:


                        Quick find searches on every field on the current layout that has been enabled for quick find. If you have a lot of fields that are "quick findable", this will add to the time that it takes to find records. You can use the inspector to reduce the number of fields that are searched by quick find on your layout. This is another reason why I almost never use quick find. A regular "find" usually involves a search on a much smaller number of fields and you can more easily control which are or are not used for the query.


                        A need to "search a lot of fields in the same record" often indicates that there could be a much better table/field schema set up to better organize your data.


                        Take a look at your fields while in layout mode and notice the magnifying glass badges that they have. (These are sometimes called "lollypops" and sometimes the "handle" doesn't show and you just see a colored circle.) You may need to select "Show > Quick Find" while in layout mode to see them. The green badges indicate a field that will be searched quickly. Yellow identifies fields that take longer to search. Yellow marked fields are typically either unstored, unindexed, or from a related table. The fewer "yellow badged" fields included in your Quick Find, the faster your search.