5 Replies Latest reply on Mar 15, 2013 12:44 PM by philmodjunk

    (more) Find Script help

    Svetlana

      Title

      (more) Find Script help

      Post

           Hello!


           I need help modifying a find script that I already have. I’m still quite new to this, so I apologize if what I’m asking for is improperly stated or unclear. I'm still getting the hang of everything, including the jargon. I’ll do my best.  

           The original find script I have (thanks to all the help from this forum!) finds all records whose Start Ship Date field value is the range of dates between the current date and 14 day in the future.

           This is the current script that I have:

           Go to Layout ["Log1" (Logistics)]
           Enter Find Mode []
           Set Field [Logistics::Start Ship Date; Get ( CurrentDate )  & "..."  & Get ( CurrentDate ) + 14]
           Set Error Capture [On]
           Perform Find []
           If [not Logistics::Start Ship Date   =   Get ( CurrentDate )  & "..."  & Get ( CurrentDate ) + 14 // no records were found ]
                   Show Custom Dialog ["ERROR"; "No Records were found by this search."]
           End if

            

           In the modified script, the records found must have a Start Ship Date of ≤ 14 days from the current date- omitting records that have “Cancelled” or “Shipped” in the PO Status field. I’m having difficulty explaining the proper date range needed for the Start Ship Date field. When I say “≤  14 days from the current date,” I am also including dates that are in the past (in relation to the current date), as long as the PO Status for that record is NOT “Cancelled” or “Shipped.” I hope that makes sense.

            

           My own attempts at modifying this script haven’t worked, so I’d appreciate any help I can get.

            

           Thank you!

        • 1. Re: (more) Find Script help
          philmodjunk

               Go to Layout ["Log1" (Logistics)]
               Enter Find Mode []
               Set Field [Logistics::Start Ship Date; "<"  & Get ( CurrentDate ) + 14]
               New Record/Request
               Set Field [Logistics::PO Status ; "Cancelled" ]
               Omit Record
               New Record/Request
               Set Field [Logistics::PO Status ; "Shipped" ]
               Set Error Capture [On]
               Perform Find []
               If [not Get ( FoundCount ) // no records were found ]
                       Show Custom Dialog ["ERROR"; "No Records were found by this search."]
               End if

          • 2. Re: (more) Find Script help
            Svetlana

                 Thank you so much for the quick respose!

                 Should I include another Omit Record step after Set Field [Logistics::PO Status ; "Shipped" ] ?
                  

            • 3. Re: (more) Find Script help
              philmodjunk

                   Good catch!

                   Yes, omit record needs to be included for the last request created by this script.

                   Omit record, BTW, changes a find request into an omit request just as though you had clicked the Omit button in a manual find.

              • 4. Re: (more) Find Script help
                Svetlana

                     Where in the script would be the correct place to include the Perform Find step?

                • 5. Re: (more) Find Script help
                  philmodjunk

                       The correct place for Perform Find is shown in the sample script that I posted. If I include the missing step for omit record, it becomes:

                       Go to Layout ["Log1" (Logistics)]
                       Enter Find Mode []
                       Set Field [Logistics::Start Ship Date; "<"  & Get ( CurrentDate ) + 14]
                       New Record/Request
                       Set Field [Logistics::PO Status ; "Cancelled" ]
                       Omit Record
                       New Record/Request
                       Set Field [Logistics::PO Status ; "Shipped" ]
                  Omit Record
                       Set Error Capture [On]
                  Perform Find []
                       If [not Get ( FoundCount ) // no records were found ]
                               Show Custom Dialog ["ERROR"; "No Records were found by this search."]
                       End if