5 Replies Latest reply on Jan 18, 2010 1:33 PM by ninja

    Date Script

    Scooter62

      Title

      Date Script

      Post

      FMPro 8.5, Mac OS 10.4

       

      I'm trying to build a script that will only show records where the date in a date field is four days before the current date or later. The script is to work from a button, so that uses the current date at the time the button is selected. 

       

      I can get it to work showing dates greater-than or equal to the current date, but not greater than or equal to four days before the current date.

       

      Any help would be greatly appreciated. 

        • 1. Re: Date Script
          ninja
            

          Howdy scooter,

           


          Scooter62 wrote:

          I can get it to work showing dates greater-than or equal to the current date, but not greater than or equal to four days before the current date.


           

          When you reference the Get (CurrentDate), simply change that to Get(CurrentDate) -4

           

          Enter Find Mode

          SetField [ Yourfield ; Get(CurrentDate) - 4 ]

          Perform Find []


          • 2. Re: Date Script
            Scooter62
              
            Thanks. That makes sense, and I did it. However, I think there is something I'm still missing.
             
            I've added the Set Field [MyField ; Get(CurrentDate) - 4] as you suggested
             
            Then, in the Perform Find the only thing I can see to do is MyField [>=//]
             
            I get no error messages, but it still returns only the current date and later. It seems like I'm resetting back to the current date when I do the Perform Find. 

            What am I missing?
            • 3. Re: Date Script
              philmodjunk
                

              Apologies Ninja for butting in but you meant:

               

              SetField [ Yourfield ; ">" & Get(CurrentDate) - 4 ]

              • 4. Re: Date Script
                Scooter62
                   Thanks much PhilModJunk! That did it.
                • 5. Re: Date Script
                  ninja
                    

                  Yep, that's what I meant when I typed "When you reference..." since the OP stated that it was already working the way it was intended...but for the wrong date.

                   

                  then I confused the issue with that script excerpt...