6 Replies Latest reply on Apr 11, 2017 10:40 AM by philmodjunk

    portal search from a global field, all in a popover

    sdurante

      Search Comments::cAllOldComments = Globals::GFCommentsSearch

      The above is the filter that doesn't filter. It produces no lines of data in the portal.

      If I set the filter to IsEmpty (Globals::GFCommentsSearch) and leave the Globals::GFCommentsSearch field empty, each record shows up in a  portal row as it should. That leads me to think there is something I don't know about filtering.

      Is it just like a find? Or does the match have to be all and exact? And is "Search Comments::cAllOldComments = Globals::GFCommentsSearch" a valid way to filter/select records that have content in the Search Comments::cAllOldComments field that match the contents of Globals::GFCommentsSearch ?

        • 1. Re: portal search from a global field, all in a popover
          philmodjunk

          It has to be an exact match.

           

          Here's a sketch of how a portal filter works:

           

          FileMaker pulls up a set of related records as specified by the underlying relationship.

          FileMaker then takes the portal filter expression and evaluates it once for every related record. The expression is evaluated exactly like any other calculation. If the expression evaluates as either True or some numeric value other than zero or null, the related record is allowed to appear in the portal.

           

          so unless Comments::cAllOldComments exactly matches Globals::GFCommentsSearch, the related record will not appear in the portal.

           

          There are also update issues with portal filters and global fields.

           

          You might look at the working examples of such search portals here:

           

          Adventures in FileMaking #2-enhanced value selection

           

          and for those of you downloading the file from this link, please read the "geek busking" info on the first layout.

          1 of 1 people found this helpful
          • 2. Re: portal search from a global field, all in a popover
            kazznfx

            Hi there,

             

            Portal filtering calculations are extremely touchy and frankly I have lots of issues getting them to work properly.

             

            However I usually shortcut all of that using SQL. Have you considered using a LIKE SQL statement and a complex key to validate the relationship?

             

            That will have the added advantage of being able to find a search term within a string not just a string that starts w/ your search term.

            • 3. Re: portal search from a global field, all in a popover
              kazznfx

              Thanks Phil!

               

              I could have used your explanation a long time ago

              • 4. Re: portal search from a global field, all in a popover
                sdurante

                Thanks.

                I've looked at "Adventures in FileMaking #2-enhanced value selection" before and couldn't see how to apply it to my need. I'll examine it again.

                I have two portals set up using Dynamic Portal filtering and I love them, but for this one I need something that is not dynamic as the contents of this particular field are large and dynamic filtering is too slow. (I haven't set a timer on any of the dynamic portal filters; maybe I'll try that too.)

                • 5. Re: portal search from a global field, all in a popover
                  sdurante

                  Can you point me to scripting to find a string of text anywhere in a field?

                  • 6. Re: portal search from a global field, all in a popover
                    philmodjunk

                    but for this one I need something that is not dynamic as the contents of this particular field are large and dynamic filtering is too slow. (I haven't set a timer on any of the dynamic portal filters; maybe I'll try that too.)

                     

                    Instead of onObjectModify, you can use OnObjectExit or OnObjectSave to refresh the portal only after entering all the search text that you want to use instead of keystroke by keystroke.

                     

                    Can you point me to scripting to find a string of text anywhere in a field?

                     

                    The PatternCount portal filter example in the Adventure File does that.

                     

                    In a script, a scripted find can do that as well, You might use a Virtual List technique that works off the found set produced by a scripted find. Test for acceptable performance with care as with any possible approach that you choose to use.