4 Replies Latest reply on Nov 19, 2012 1:19 PM by philmodjunk

    Scripting an "and" for a found set

    Kirk_1

      Title

      Scripting an "and" for a found set

      Post

           How do i script an "and" for a found set?

           I want it to find every thing that has the field "ok to clear" and "pending" checked. The 1 is Boolean and the x is a place holder...

           If i put them together in the script like i have it below, it will only find the items that have both checked.

             
      •           Go to Layout [ “Clear Invoices” (Invoice) ]
      •      
      •           Enter Find Mode [ ]
      •      
      •           Set Field [ Invoice::INOkToClear_calc; "x" ]
      •      
      •           Set Field [ Invoice::INPending; "1" ]
      •      
      •           Perform Find [ ]
      •      
      •           Sort Records [ Specified Sort Order: Invoice::INShipmentDate; ascending ] [ Restore; No dialog ]

        • 1. Re: Scripting an "and" for a found set
          philmodjunk
               

                    If i put them together in the script like i have it below, it will only find the items that have both checked.

               That IS an AND based found set: Find all records where one field is "x" AND the other is "1".

               You want an OR type of find if you want all records where one field is "x" OR the other is "1".

                 
          •           Go to Layout [ “Clear Invoices” (Invoice) ]
          •      
          •           Enter Find Mode [ ]
          •      
          •           Set Field [ Invoice::INOkToClear_calc; "x" ]
                      New Record/Request
          •      
          •           Set Field [ Invoice::INPending; "1" ]
          •      
          •           Set Error capture [on]
                      Perform Find [ ]
          •      
          •           Sort Records [ Specified Sort Order: Invoice::INShipmentDate; ascending ] [ Restore; No dialog ]
          • 2. Re: Scripting an "and" for a found set
            Kirk_1

                 The new record/request, clears out the 1st find parameters.

                  

                   
            •           Enter Find Mode [ ]
            •      
            •           Set Field [ Invoice::INOkToClear_calc; "x" ]
            •      
            •           Set Field [ Invoice::INOkToClear; "yes" ]
            •      
            •           Set Field [ Invoice::INPosted; "yes" ]
            •      
            •           New Record/Request
            •      
            •           Set Field [ Invoice::INPending; "1" ]
            •      
            •           Set Error Capture [ On ]
            •      
            •           Perform Find [ ]

                 What do i need to do?

            • 3. Re: Scripting an "and" for a found set
              Kirk_1

                   I figured it out..

              • 4. Re: Scripting an "and" for a found set
                philmodjunk

                     It doesn't clear them out. It starts a new blank find request.

                     I'm not at all clear on what results you want to see from this script.

                     What you have posted will find all invoice records where

                     INOkToClear_calc equals or starts with the letter "x",

                     INOkToClear equals or starts with the text: "yes"

                     AND

                     INPosted equals or starts with the text "yest"

                     in the first find request and then adds to them

                     all invoice records where INPending = 1 (if it is a number field) or that starts with "1" if it is a text field.

                     from the second request.