cancel
Showing results for 
Search instead for 
Did you mean: 

Last Hour Records in Select Expert

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Is this a datetime field or just a time field? Is there a date field that you need to account for as well so that you don't pick records from another date?

Former Member
0 Kudos

The field is a datetime field and I want to select records for just that day which I was planning to use another field called {Interaction.Date_Created} - also a datetime field.

Thanks.

Former Member
0 Kudos

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

Answers (0)