Solved

Crystal Report Time Frame Selection

Posted on 2013-12-26
7
753 Views
Last Modified: 2013-12-27
I have never stumbled across a need for something like this so I thought I'd ask you guys for some perspective and help.  I have built a report as requested but I'm having trouble figuring out how to make it run for the time frames requested.

The report needs to run from 8am the previous day up to 8am the current day, every day.  I am unsure even where to begin to state this or how to go about doing it.  I can somewhat picture the logic in my head, something along the lines of CurrentDate -1 or something similar but have no idea as to the proper syntax or placement.  If I were to just specify the dates it would look like the following:

12/25/2013 8:00:00am to 12/26//2013 7:59:59am

However, I need it to just run with no user input so I don't think providing input parameters would work in this situation.

To compound the issue I have to use a formula to correct the times that return because, for whatever reason, Crystal sees the data as several hours ahead of time.  I have fixed that issue but I have to now use that adjusted time frame as the selection criteria.

Any help you guys can offer would be greatly appreciated.

Thank you!
0
Comment
Question by:StrawsPulledAtRandom
7 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 39740505
Crystal isn't seeing the datetime as several hours ahead, the database is probably storing them in GMT and they need to be adjusted when retrieved.

Try this

{yourDateTimeFIeld} >= DateTime(CurrentDate - 1, Time(8,0,0))
AND
{yourDateTimeFIeld} < DateTime(CurrentDate, Time(8,0,0))

mlmcc
0
 

Author Comment

by:StrawsPulledAtRandom
ID: 39740510
Any idea how I could go about adjusting that when received properly?  Right now I'm using a formula to do it in a separate field.
0
 
LVL 18

Expert Comment

by:vasto
ID: 39740630
this will return yesterday 8:00 AM
DateAdd("h",8,CurrentDate -1)

in report sekection formula you can do something like

DateAdd("h",8,CurrentDate -1) <={table.field} AND {table.firld}<DateAdd("h",8,CurrentDate)

You need to correct the timezone information on the server. What is you database ?
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 100

Expert Comment

by:mlmcc
ID: 39740689
Is it a standard difference?

If so just adjust the start and end times

For instance if you want to filter based on East Coast (US - 5 hours GMT) then use


{yourDateTimeFIeld} >= DateTime(CurrentDate - 1, Time(13,0,0))
AND
{yourDateTimeFIeld} < DateTime(CurrentDate, Time(13,0,0))


mlmcc
0
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 39740711
Is this a report you're scheduling through Crystal Reports Server or BusinessObjects Enterprise\SAP BI?
0
 

Author Comment

by:StrawsPulledAtRandom
ID: 39740773
No, this is not using either the CR server or the BO/SAP server.
0
 

Author Closing Comment

by:StrawsPulledAtRandom
ID: 39742864
Your formula worked right out of the box, no modification other than the variable change needed.  Thank you very much for your help.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

772 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