Command Object - Parameters
I'll do the best I can to explain my dilemma. I'm using Crystal XI and have a report where I use several Command Objects and link them in the report.
Each command object is a SQL statement for a day of the week.
EX: Command1 = Sun
Command2 = Mon
Etc
Within the SQL statement, I set up a parameter on the "Where" clause of each Command object that looks like this:
Work.Date={?Sun}
Work.Date={?Mon} etc
The Work.Date field is an int datatype, not an actual date field. In most of my raw SQL statements, I do a conversion such as this:
Cast(
Substring(Convert(Varchar,Work.Date),5,2)+'-'+
Substring(Convert(Varchar,Work.Date),7,2)+'-'+
Substring(Convert(Varchar,Work.Date),1,4) as Datetime)
This will typically get the format that I need. When I do this in the Select statement of the Command Object, it returns the data in the Crystal Report in the correct format.
However, what I'd like to do is something like this:
WHERE
Cast(
Substring(Convert(Varchar,Work.Date),5,2)+'-'+
Substring(Convert(Varchar,Work.Date),7,2)+'-'+
Substring(Convert(Varchar,Work.Date),1,4) as Datetime)={?Sun}
and set the parameter to datatype Date or Datetime in the Create Parameters box so I can use the calendar to select dates on prompt. However, it's throwing an error each time I run that. Does anyone have any suggestions?
Thanks!
Flam, June 2nd, 2009 03:56 AM
Bookmarks