Solved

More efficient formula to get records for last 24 hours

Posted on 2004-09-26
2
1,535 Views
Last Modified: 2008-03-17
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.


 
0
Comment
Question by:DavidNPD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 28

Accepted Solution

by:
bdreed35 earned 50 total points
ID: 12156030
Try this in the Records Selection formula:

{cfs.rec_dt} in currentdatetime - 1 to currendatetime
0
 

Author Comment

by:DavidNPD
ID: 12156272
Thanks, I added the missing "t" and then that worked great.

{cfs.rec_dt} in currentdatetime - 1 to currenTdatetime
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question