6 Replies Latest reply on Dec 8, 2015 7:59 AM by siplus

    how to omit records in a find script?

    weedonpaul

      I feel like I should know how to do this.

       

      I want to find all the actions for the next 7 days but omit any that are marked as finished. my script looks like this but without the omit part:

       

      enter find mode []

      set field [actions::action_deadline; Get(CurrentDate) & "..." & Get(CurrentDate)+7]

      Perform find [restore]

       

      I want to further omit records where Action::status=finished, there isn't a "not equal" to operator that I can put in the status field. so I can't put set field [actions::status; ≠finished]

       

      how should I do it?

        • 1. Re: how to omit records in a find script?
          Mike_Mitchell

          The Omit Record script step toggles the Omit option in Find mode.

           

          Mike

          • 2. Re: how to omit records in a find script?
            CarlSchwarz

            I think these are the script steps you want

             

            Enter find mode

            set field(actions deadline::date...

            new record/request

            set field status = finished

            omit

            perform find

            • 3. Re: how to omit records in a find script?
              siplus

              While the other posters are correct, after all these years I still find it VERY confusing for people stepping in Filemaker's scripting world and wording to use the "Omit Record" script step for achieving what the OP wants.

               

              The correct script step, ensuring that the reader of our script understands what's going on (and that includes ourselves after 3 years of not looking at the script) would be

               

              New find Request [type = add, omit, constrain, extend]

               

              maybe in Filemaker 17 ?

              • 4. Re: how to omit records in a find script?
                weedonpaul

                thanks everyone. I wasn't sure weather it was omit record or omit multiple records. works great now

                • 5. Re: how to omit records in a find script?
                  beverly

                  yes, good answers! I also want to point out that Restore is probably not to be done in scripted finds, as you may 'undo' what you previously scripted. Just Perform Find (no options) is preferred - be aware of how this works!

                   

                  I like to do this:

                  Enter Find Mode (no restore, no pause)

                  ... do your find criteria ...

                  Perform Find (no restore)

                   

                  OR use Enter Find Mode ( restore ) instead of above

                  OR use Perform Find ( restore ) instead of above

                   

                  From there you can:

                  • Modify Last Find

                  • Constrain Found Set (for scripted, probably no restore)

                  • Extend Found Set (for scripted, probably no restore)

                   

                  Generally I try to figure out what to do manually and then script from there. I also like to think of the GTRR (Go to Related Records) as a find from parent to child records and may use it like the "restore" and perhaps use the Constrain or Extend from there.

                   

                  I opine that the full steps for scripted finds are easier to debug then having to peek at what's 'stored' in the Enter Find Mode (restore), Perform Find (restore), Constrain Found Set (restore), or Extend Found Set (restore).

                   

                  beverly

                  • 6. Re: how to omit records in a find script?
                    siplus

                    completely agree. Restore sux 101% on the script readability scale, too.