Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time in reports

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello

Sorry this is probably an easy question but I am new to Crystal.

I am trying to build a formula to pull data from a database which will be between the current time and 5 hours previous to it. I can't seem to find a way to do it.

Many thanks in advance.

Rich
 
GO to report, edit selection formula, record and enter a formula like this one:

{DateTimeField} in CurrentDateTime to Dateadd("h",-5,CurrentDateTime)

Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
Hello Thanks for the quick reply. However when I do this is don't get any data returned.

The date is a field coming from the database. it looks like below if this helps.

{version_jazchar.data_type} = 1 and
{dir_common.name} = "RICHARDNE" and
{file_common.edit_time} = CurrentDateTime to Dateadd("d",-100,CurrentDateTime)

Many Thanks

Richard
 
Hi

Still no Joy, I think I put the equals in after I had initially tried it the first time when I was messing about with it.

This it what it actually is like and still doesn't work. It had the d -100 also when I was messing about

{version_jazchar.data_type} = 1 and
{dir_common.name} = "RICHARDNE" and
{file_common.edit_time} in CurrentDateTime to Dateadd("h",-5,CurrentDateTime)

Thanks Again

Richard
 
First, the currentdatetime end period isn't required, as I assume that you don't have dates later than the current.

This alone should work:
{file_common.edit_time} >= Dateadd("h",-5,CurrentDateTime)

Make sure that this field contains a proper datetime type, and don't complicate debug by adding in other criteria until this portion is working.

-k kai@informeddatadecisions.com
 
Hi synapsevampire

Unfortunately that is not the case, there will be items that will be newer than when the report is run when it is used in its live environment. The report is going to be run at 5.30 every morning and is to look at all items since 12.30 and then put these into the report.

Thanks again

Richard
 
Please ignore my last message this will do the the response from synapsevampire will do the trick.

Thanks a lot to everyone that has helped me with this problem your help has been invaluable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top