Skip to Content
0

Date vs datetime; multiple select records in select expert

May 11, 2017 at 12:54 PM

45

avatar image

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Abhilash Kumar
May 11, 2017 at 01:34 PM
1

Hi Dan,

Try:

{CRV_UsageLog.LogTimeStamp} = {?DateSelect} and

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

-Abhilash

Share
10 |10000 characters needed characters left characters exceeded