Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Last Hour Records in Select Expert

I am using Crystal Reports version 10 and want create a formula which will select records created in the last hour.

Is this possible?

Within the select expert, you have existing formulas/date ranges such as LastFullWeek/LastFullMonth/Last7Days but I need a formula which will select LastFullHour.

The field I am using is {Interaction.Time_Created} which contains records in the HH:MM format.

Thanks in advance

replied

This will give you the last 60 minutes from the second the report was run:

{table.datetimefield} in dateadd("h",-1,currentdatetime) to currentdatetime

And if you wanted the last completed hour, then use this:

in dateadd("h",-1,dateadd("n",-minute(currentdatetime),dateadd("s",-second(currentdatetime),currentdatetime))) to_

dateadd("n",-minute(currentdatetime),dateadd("s",-second(currentdatetime),currentdatetime))

The underscore is there by design

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question