1 Reply Latest reply on Dec 13, 2012 1:59 PM by philmodjunk

    scripting assistance please

    GregSmith_1

      Title

      scripting assistance please

      Post

           Hey All --

           I'm learning, but need help setting up a 2 part or 2 step script

           Step 1 - I need to locate all records that have a date of less than a given date - ie. all customers that have not made a purchase since 1/1/2012 - and I have a field that I can check the date

            

           Then once all of those records are found I need to tell the user how many records were found and then let them confirm they want to set the record active field to "no"

            

           Now I have a script that I can use to change the active field to "no" and it works great - how ever I need to setup this two step script so it is simple for another user

           Can anyone help me out with this?

            

        • 1. Re: scripting assistance please
          philmodjunk

               I have a field that I can check the date

               But does your field have global storage specified. This can make a difference in how to write the script:

               If you have a date field with global storage start with these script steps:

               Enter Find Mode [] --> clear the pause check box
               Set Field [YourTable::YourDateField ; "<" & YourTable::YourGlobalDateField]

               If field is not a global field, start with these steps:

               Set variable [$Date ; value: YourTable::YourSpecifiedDate ]
               Enter Find Mode [] --> clear the pause check box
               Set Field [YourTable::YourDateField ; "<" & Y$Date ]

               With either case, then continue your script with these steps:

               Set Error Capture [on]
               Perform Find []
               IF [ Get (FoundCount ) // records less than specified date were found]
                  Show Custom Dialog [ Get ( FoundCount ) & " records were found. Set active to 'no'?"]
                  If [ get ( LastMessageChoice ) = 1 // First button (OK) was clicked]
                     Perform script [specify your script to set field to No here]
                  End If
               End IF