3 Replies Latest reply on Jan 15, 2010 2:54 PM by trialuser1111

    Difficulty with an "omit find request" script

    trialuser1111

      Title

      Difficulty with an "omit find request" script

      Post

      I am having difficulty troubleshooting a behavior quirk in my database, and I think I've narrowed down the culprit to a fairly simple script for omitting find requests.

       

      To allow users to perform more complex searches, I have created a dedicated "Find Contact" layout allows users to build multi-step searches in a more visually logical list format.  Next to each row, users have a small array of buttons to add/delete new search steps and designate each step as an "omit" or not.  This is the script assigned to the "Omit" button:

       

      Omit Record

      If [Get (RequestOmitState) = 1]

         Set Field [Contacts::Include?; "No"]

         Exit Script []

      End If

      Set Field [Contacts::Include?; "Yes"]

       

      The reason for the extra steps is that the field Contacts::Include maps to a conditionally-formatted background (green for include, grey for omit).  Pressing the button does trigger the conditional formatting so I know it's working, and when I show the status bar, I can see the toggle switch back and forth from Include to Omit.  However, when I execute the search, the step is essentially ignored in the results.  I have tried manually switching from Include/Omit in the status bar and creating another button that just toggles Include/Omit without the added steps.  These have both yielded accurate search results.

       

      Why would these extra steps impact my search results, and how can I fix it? 

        • 1. Re: Difficulty with an "omit find request" script
          trialuser1111
            

          Update: I have simplified the script and I get the same (inaccurate) results:

           

          Omit Record

          Set Field [Contacts::Include? ; Case (Get(RequestOmitState) = 1 ; "No" ; "Yes")]

           

          Why would this extra step make a difference in my results? 

          • 2. Re: Difficulty with an "omit find request" script
            philmodjunk
              

            One thing to consider: Omit type requests should be left as the last requests specified. Filemaker performs the find request in sequence from first request to last and placing the omit request item before a non omit request can affect your results.

             

            If you...

             

            Omit all left handed bottle washers

            Find all bottle washers

             

            The omit will be as though it never happened as the second find will counteract the results of the Omit.

             

            If you...

            Find all bottle washers

            Omit all left handed bottle washers

             

            You'll get the expected results of find all right handed and ambidextrous bottle washers.

            • 3. Re: Difficulty with an "omit find request" script
              trialuser1111
                 Thanks.  I did pick that up in my testing, though I have followed the EXACT same process for my successful and unsuccessful searches and the only difference (so far as I can tell) is my choice to use the Omit button with the associated script or the test button which is dedicated just to omitting the record.