More efficient formula to get records for last 24 hours

I have a report that needs to bring up any records entered in the last 24 hours. This will be evaluated against the current date.

Right now I use 2 formulas to do this, the first is this:

DateDiff ("h", CurrentDateTime,{cfs.rec_dt})

This is called "ulaLast24Hours"
Where cfs.rec_dt is the field that holds the Date and Time of the incident.

and then in the parameters for the report I use this:
{@ulaLast24Hours} > -24.00

This does what I want but seems to be very slow as it goes through the entire database to find the records. What would be a more effiicient method of bringing up the records I need. I am using Crystal Reports Developer 8.5.


 
DavidNPDAsked:
Who is Participating?
 
bdreed35Connect With a Mentor Commented:
Try this in the Records Selection formula:

{cfs.rec_dt} in currentdatetime - 1 to currendatetime
0
 
DavidNPDAuthor Commented:
Thanks, I added the missing "t" and then that worked great.

{cfs.rec_dt} in currentdatetime - 1 to currenTdatetime
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.