on 05-11-2017 1:54 PM
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?
Hi Dan,
Try:
{CRV_UsageLog.LogTimeStamp} = {?DateSelect} and
Time({CRV_UsageLog.LogTimeStamp}) = {?TimeSelect}
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.