cancel
Showing results for 
Search instead for 
Did you mean: 

Date vs datetime; multiple select records in select expert

Former Member
0 Kudos

Crystal Report 2016; datasource is MS Sql Server 2008 R2 via ODBC

I'm trying to do a select on the same datetime in the select expert / formula. I have a datetime field in the database (I am pretty sure it's datetime), and I can do a select record rule o

{CRV_UsageLog.LogTimeStamp} = {?DateSelect}

and that does what I want. It's tied to a parameter, so when I run the report, I am prompted to enter in a start and end date. The report uses those dates to select only the appropriate records.

If I try to add in a second select based on that same database field, I get an error. If I do this:

{CRV_UsageLog.LogTimeStamp} = {?DateSelect} and

{CRV_UsageLog.LogTimeStamp} = {?TimeSelect}

On checking syntax, then I get an error "A datetime is required here", where "{?TimeSelect}" is selected. "?DateSelect" is a date parameter, "?TimeSelect" is a time parameter, and "CRV_UsageLog.LogTimeStamp" is a datetime field in the database.

I don't understand what Crystal Reports is trying to tell me, or if I'm doing it right. What I want do is have the date range be several days or weeks, and then the time range apply to the those already selected days. I believe this constitutes an inner join, and that "and" would be the appropriate operator.

What am I doing wrong? Do I need to do some form of casting to make the data types play nice?

Accepted Solutions (0)

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor

Hi Dan,

Try:

{CRV_UsageLog.LogTimeStamp} = {?DateSelect} and

Time({CRV_UsageLog.LogTimeStamp}) = {?TimeSelect}

-Abhilash