3 Replies Latest reply on Mar 12, 2013 10:19 AM by philmodjunk

    Having Trouble Understanding Find

    RichardAdams

      Title

      Having Trouble Understanding Find & Omit in Scripts.

      Post

           On a specific layout, I am trying to find:

           everyone NOT marked "Not Attending" for Status (Omit)

           Everyone marked "F" for Gender

           Everyone not marked "Child" for MartialStatus

           Ultimately, in English, this should give me women, who aren't marked as a Child, who are not marked "Not Attending".

            

           It's not...

           I set these up as different Perform Find parts of a script, but one or a few of them don't seem to work...

           If I do "Find Gender = F" it doesn't remove males.

           I must be doing something wrong or not understanding the utility of the different modes.

           Any pointer to a guide that may word it or explain it different (I read the filemaker online stuff, still didnt clear it up for me).

            

           Thanks a bunch!

            

        • 1. Re: Having Trouble Understanding Find & Omit in Scripts.
          philmodjunk

               To do this you need three "requests" for your find. The first needs to specify criteria for what you want to include and the second and third specify criteria that you want to exclude (omit). Omit requests modify the results produced by the preceeding requests so they should always be added last.

               Here's a scripted form of what you are describing:

               Enter Find Mode [] ---> clear the pause check box
               Set Field [YourTable::Gender ; "F" ]
               New Record/Request
               Set Field [YourTable::MaritalStatus ; "Child" ]
               Omit Record
               New Record/Request
               Set Field [YourTable::status ; "not attending"]
               Set Error Capture [on]
               Omit Record
               Perform Find []

               In find mode, new Record/Request creates a new request instead of creating a new record and Omit record when performed in find mode is the scripted equivalent of clicking the Omit button in a manual find.

               It is also possible to specify this same criteria inside the Perform Find step, but I prefer to script finds with set field steps so that I don't have to open a special dialog in order to examine what criteria was specified.

          • 2. Re: Having Trouble Understanding Find & Omit in Scripts.
            RichardAdams

                 I definitely appreciate the in-depth response.

                 The way you explained it made a lot of sense.

                 Before you responded, I ended up finding "Constrain Found Set", which did what I needed it to do, but having to click on that or Perform Find to see what the search modifier was is annoying (as you described), so your way looks a lot better!

            • 3. Re: Having Trouble Understanding Find & Omit in Scripts.
              philmodjunk

                   In scripted finds similar to my example, you can use constrain found set, or extend found set in place of Perform find--though some of the other script steps would have to be different before the results would be the same.

                   When dealing with large sets of records in the table being searched, you can sometimes get much quicker results if you preform one find--specifying criteria only in stored/indexed fields. Then return to find mode to specify criteria in unstored/unindexed fields and constrain the found set.