Wednesday, March 7, 2012

Dynamic Date Parameter in Report Manager

Hi all,

I was wondering if there's a way to override the default date parameter of a report to a dynamic value such as Today(), Now(), DateAdd(),... through Report Manager.

I know this can be done in Report Designer, but never been successful when I try to change the date parameter value in Report Manager.

I've tried to change the date parameter value by clicking on the Override Default button in the report's properties page from Report Manager, error like the one below will be shown after I entered Now() in the Default Value field and clicked Apply:
The value provided for the report parameter 'StartDate' is not valid for its type. (rsReportParameterTypeMismatch)

Thanks in advance.

You can set defaults by editing the parameter properties from the Layout tab. Just right click anywhere on the "blank" non used area of your report. Click the "Report Parameters" option. Select the parameter you want to default, and use the Non-Queried option. I used the following code to set Start and End date defaults for the current month. Hope that this helps.

For the Start Date parameter I have this in the box:

=DateAdd("d",-Day(Today())+1,Today())

End Date:

=DateAdd("h",23,DateAdd("d",-1,DateAdd("m",1,DateAdd("d",-Day(Today())+1,Today()))) )

For October of 2006, this should set the Start and End date parameters to 10/01/2006 12:00:00 AM and 10/31/2006 11:00:00 PM

|||

Does anyone have a solution to the original question? Because if you override the default and put in an expression, you get an error like stated in the first post. It works before you override the default, but if you override the default and then enter in the modified expression, I get 'Syntax error converting datetime from character string.'

Thanks,

Iris

No comments:

Post a Comment