3 Replies Latest reply on Feb 20, 2012 3:26 PM by comment

    Time calculation / Filtering

    tcenguyen

      Hi All,

      I am trying to display the records by date and time.

      1. I have Table 1 with Time ; Date is auto entered when the record created. and a Text filed and the notes entry.

      2. I need to have the report that generate records by the following criteria.

      ** All records from the last 24 hours , at the time that user run the script.

      or ** All recrods that run by the script that base on today time 6:00 AM - 24 hour.

       

      Please advice.

       

      Thanks all

        • 1. Re: Time calculation / Filtering
          comment

          tcenguyen wrote:

           

          ** All records from the last 24 hours , at the time that user run the script.

           

          This would be easier if you had a Timestamp field, even as a calculation =

           

          Timestamp ( Date ; Time )

           

          Without such field, you will need to create 2 requests: one for records where Date = Get (CurrentDate) and one for records where Date = Get (CurrentDate) -1 and Time > Get (CurrentTime).

           

           


          tcenguyen wrote:

           

          ** All recrods that run by the script that base on today time 6:00 AM - 24 hour.

           

          This one I didn't understand.

          • 2. Re: Time calculation / Filtering
            tcenguyen

            Hi Michael,

            Thanks.

            I have created two field called calcD (currentdate -1) and calcT (currentTime) as timestamp, then I created another field CalCombine with your instruction CalCombine(calcD;calcT). I would have the date display as one day before and the time is auto enter as realtime.

             

            I did the same thing as above with a filed call calcurrentCombine; all I have to do is specify the currentdate as current instead -1.

             

            Now I do have value as

            Calcombine                     2/19/2010 4:00 pm

            CalCurrentCombine        2/20/2010 4:00 pm

             

            Thanks again.  Is there a shorter way to do this. and how do I trigger this in the script ( my second question).

            • 3. Re: Time calculation / Filtering
              comment

              I am afraid we are not on the same page here. You don't need those calculation fields you have created. You only need a script that does:

               

              Enter Find Mode []

              Set Field [ YourTable::Date ; Get (CurrentDate) ]

              New Request

              Set Field [ YourTable::Date ; Get (CurrentDate) - 1 ]

              Set Field [ YourTable::Time ; ">" & Get (CurrentTime) ]

              Perform Find []