This is a migrated thread and some comments may be shown as answers.

Problem with Date filters that use conversion functions

1 Answer 35 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Josh Turpen
Top achievements
Rank 1
Josh Turpen asked on 16 Mar 2010, 05:53 PM
I cannot seem to get a Date filter to work that uses conversion routines.  The schema which I'm reporting against stores all dates as OLE automation dates (double precision floating point).  I have a static utility function, DateTime MyLib.Utilities.FromOADate(Nullable<Decimal> dt) which wraps the System.DateTime.FromOADate() routine and exposes it to the report.   This way, in the report I can use an expression, e.g.={MyLib.Utilities.FromOADate(Fields.[StartDate])}.  This seems to work correctly for report output.

When I try to setup a filter for start date using a similar method, I get an error 'Cannot apply >= to types System.DateTime and string'.  When I use the expression editor, the expression created is:
=MyLib.Utilities.FromOADate(Fields.[StartDate])   (without the {}'s, adding them seems to be a syntax error )

My filter definition looks like:

Expression                                                                            Operator                      Value
=MyLib.Utilities.FromOADate(Fields.[StartDate])                       >=                            =Parameters.Parameter1   (DateTime)
=MyLib.Utilities.FromOADate(Fields.[StartDate])                       <=                            =Parameters.Parameter2   (DateTime)



  I've barely started to look into Telerik Reporting so I may be missing something obvious.  Any help would be appreciated.

Thanks,
Josh

1 Answer, 1 is accepted

Sort by
0
Josh Turpen
Top achievements
Rank 1
answered on 16 Mar 2010, 11:52 PM
I managed to work around the problem by doing the OA date conversion at the DataSet/Table Adapter level instead of at the Report Parameter level.  From the report's point of view those OA dates are all DateTime objects now, and everything seems to work correctly.
Tags
General Discussions
Asked by
Josh Turpen
Top achievements
Rank 1
Answers by
Josh Turpen
Top achievements
Rank 1
Share this question
or