Solved

Crystal Report Time Frame Selection

Posted on 2013-12-26
7
748 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now