4 Replies Latest reply on Oct 31, 2013 3:38 PM by cortical

    How to do substring search in finds?


      I would like to have a pick list (or any kind of list) that shows all the contact names with a search box at the top. As letters are entered in the search box the available list shrinks to those that contain the substring(s). I can do that in C++ and .NET, but do not know how to approach it in Filemaker. Is it doable?



        • 1. Re: How to do substring search in finds?

          Bob G. or Bobg


          When I find my code in tons of trouble,

          Friends and colleagues come to me,

          Speaking words of wisdom:

          "Write in C."


          ...well not me in this case but...


          Sometimes this is done using a script trigger that executes a FIND after every keystroke in a global field.  Concept is you fire the trigger after every keystroke and use the global field contents as the search criteria.  The "list" returned in this case is the found set based upon the search.


          There will be other ways...


          http://www.nightwing.com.au/FileMaker/demos.html is a good path to follow...



          • 2. Re: How to do substring search in finds?



            Thanks for the humor and some direction.  I really like FM12 once I figure out what script commands/triggers/etc. I need to use for different functions, but knowing what path to take with little experience in FM is a bit daunting sometimes.


            As a famous ball player once said… “when you come to a fork in the road, take it”


            Thanks for getting me moving again.



            • 3. Re: How to do substring search in finds?

              And here's one of those "other ways..." Stephen mentioned:



              Uses a similar approach, firing an OnKeystroke trigger.






              • 4. Re: How to do substring search in finds?

                in a nut shell


                create a global for the search string entry

                attach a script trigger to the global as an OnObjectModify, to execute script st_find

                give the search field an object name: fld_search, to allow the script to target the cursor return


                in the example extract below the global is aAdmin::g_search, and the search field is an auto enter calculation so that multiple fields can be searched concurrently




                #SEARCH BY FIND


                If [ IsEmpty( aAdmin::g_search) ]

                Show All Records

                Set Error Capture
                [ On ]
                Enter Find Mode [ ]
                Set Field [ Item::aec_keywords; aAdmin::g_search ]

                Perform Find [ ]

                End If

                #any commit must be BEFORE GO OBJECT - or else the cursor exits the field

                Go to Object [ Object Name: "fld_search" ]