1 Reply Latest reply on Sep 30, 2010 2:29 AM by LaRetta_1

    Omitting an entry based on if a date entry is more than two weeks earlier

    CoreyDrake

      Title

      Omitting an entry based on if a date entry is more than two weeks earlier

      Post

      I'm helping a friend make a script for his work's database. I literally started working with this program this evening. This site has helped me a lot in learning how to make scripts. Unfortunately I've run into a snag in my searching where I can't quite find a clear answer.

      We have an attribute called 'Date Received' and it is in m/d/y format. I've created a button that searches for only a certain attribute (In this case they need all entries with 'pass' to be viewed. This is unrelated to the problem.) However they only want entries with 'pass' to show up if the 'Date Received' is less than two weeks from the current date.

      I've found similar solutions but so far what I've found is unclear as far as where to put the scripts. Ideally, could somebody explain step by step how I would check two weeks earlier from the current date and omit those that are older?

      Thank you in advance.

        • 1. Re: Omitting an entry based on if a date entry is more than two weeks earlier
          LaRetta_1

          Hi Corey,

          I'm not sure I'm clear on the date parameter but here is my understanding and a script to make that happen.  If not correct, hopefully it will be enough that you can adjust it accordingly.  If today is 9/28/10 and you want all Date Received from 9/14/10 and forward then this calculation (in blue) will find those records:

          Go To Layout [ layout based upon table occurrence to be searched ]
          Enter Find Mode [ uncheck pause ]
          Set Field [ Date Received ; ">" &  Get ( CurrentDate )  - 14 ]
          Set Field [ Status ; "Pass" ]
          Set Error Capture [ On ]
          Perform Find [ ]
          If [ not Get ( FoundCount ) ]
          Show Custom Dialog [ OK ; "No records found" ]
          Exit Script
          End If

          This calculation uses a function called Get ( CurrentDate ) so it says in human-speak, "find dates that are greater than (>) the current date less 14 days".