1 2 Previous Next 15 Replies Latest reply on Jun 21, 2017 10:34 AM by pietergorisio

    "filter as you type" script


      I scripted a "filter as you type" routine which worked well on my Windows desktop but on Filemaker GO on my iPad it is SLOW, in fact unusable. Has anybody got a good routine which they will share and will work well on iOS?


      PS since this feature is available in various places in Filemaker eg script list why hasn't Filemaker made it available as part of the feature set? It is used in heaps of modern interfaces.

        • 1. Re: "filter as you type" script

          I have had the same experience, and where possibly like to avoid filter as you type on any Go solutions.


          One way to optimize it would be to have the filter on an on-timer which runs every .3-.4 seconds. This is a really great way to optimize if the typing is slow on desktop, however I haven't tested on iOS yet. Since on timers work just great on iOS I imagine this might solve it.

          • 2. Re: "filter as you type" script

            you are filtering a portal by typing into a global, I presume ?

            • 3. Re: "filter as you type" script

              I use a global field for the search parameter but the items being filtered are not in a portal, just an ordinary list layout.


              On reflection, there are quite a few operations which are significantly slower on a mobile device under iOS, so I guess what is required is a better algorithm or a native filemaker action to speed things up.

              • 4. Re: "filter as you type" script

                Can you upload a sample file that demonstrates the problem you are having?

                • 5. Re: "filter as you type" script

                  Try the following:


                  Let's say your global is called gSearch.


                  in layout mode select all fields, disable quick find, then select the few you're searching on (must be indexed !) and enable quick find on them.


                  Attach this script to the OnModify trigger of your gSearch global:



                  Freeze Window

                  Set Error Capture [ On ]

                  Allow User Abort [ Off ]

                  Perform Quick Find [ QuickFindPeople::gSearch ]

                  If [ Get(LastError) ]

                    Perform Find [ Restore ]   // <--- inside here I search for "Youwontfindme" in an indexed field


                  Sort Records [ Restore ; No dialog ]

                    Go to Record/Request/Page [ First ]

                  End If

                  Go to Field [ QuickFindPeople::gSearch ]

                  • 6. Re: "filter as you type" script
                    there are quite a few operations which are significantly slower on a mobile device under iOS


                    Yes -  because the mobile devices tend to have less ram and processors speed. You have to take this into consideration when you are developing for the mobile.

                    • 7. Re: "filter as you type" script

                      I,ll try the approach set out by Siplus and let you know how it works.

                      • 8. Re: "filter as you type" script

                        I tried this approach which was similar to my orignal but it is no faster and the performance under FM Go is woeful. Thanks for your effort though, much appreciated.

                        I guess I'll have to wait a while for the hardware to speed up or better still, for Filemaker to include a native "Filter as you Type" facility.

                        • 9. Re: "filter as you type" script

                          By not positing a sample file demonstrating your problem or at least the script that you are using, makes it hard to fully trouble shot an issue. If your list has unstored calcs, conditional formatting or a very large number of records then FMGO might have trouble with speed especially if you are trying to filter on every keystroke. Instead of filtering on every keystroke you could find on Exit.   I can filter a portal on every keystroke with FMGO across a LAN very quickly.  The portal is sorted and there are 10000 records in the database.  I use a single Set field script step that gets triggered on every keystroke. My ipad is an iPad Air 1.

                          • 10. Re: "filter as you type" script

                            The best method I have found is using a portal filter.    Dynamic Portal Filtering While You Type – FileMaker Inspirations

                            • 11. Re: "filter as you type" script

                              If quickfind on an indexed field is slow for you, then I'm speechless. I have quickfinds on 1 million records in a client-server setup happening,  scoring under a second all the time. Make sure you have only one field quinckfind-enabled on the layout and it's an indexed field.


                              I do have a preferred setup for "find as you type" but it's portal-related, not list-related.

                              • 12. Re: "filter as you type" script

                                I use a variant like the one cited by schamblee. A sample file is attached.


                                When a user types in the filtering global, one timer script fires, and if another keystroke is received in less than the interval set in the script, nothing happens. For instance, if a user quickly types three letters, Dan, then has a pause equal to the interval, the find fires and a portal is populated with records that match. If the user then adds more text to the global field, the process is updated.


                                On my iPad, I've found that the interval needs to be a bit longer, so the attached demo uses a 1-second interval. On a client, .5 seconds seems to be plenty. The attached demo doesn't test for device, but it easily could.


                                The technique could also be modified to use a quick find as siplus describes.

                                1 of 1 people found this helpful
                                • 13. Re: "filter as you type" script

                                  This works so well. Even on a client-server situation with thousands of records.

                                  Thank you for sharing!

                                  • 14. Re: "filter as you type" script

                                    Quite note, in FileMaker Go 16 this filter-as-you-type works flawlessly.

                                    1 of 1 people found this helpful
                                    1 2 Previous Next