In reporting services SQL server , when I created a subscription f开发者_Go百科or a report with parameter as date time type, I don’t know how to set up value of the parameter as current date (wherever the subscription is running).
I tired Today(), Today, today, @ExecutionTime. But none of them worked for me. Only a specific date worked eg: “11/11/2010 00:00:00”.
I also tried to hide the parameter but the subscript still required to fill the parameter. For the "default value” textbox did not allow the value “Today()”, “Today”, etc.
Thanks in advance!
Helen
You need =
to make it an expressions
= Today()
You can't put "=today()" in the text box prompt at runtime. You have to setup the parameter's default value as "=today()" in visual studio.
Try Data Driven subscription and pass a SQL Statement to return the current date for the parameter value.
The following code worked on my case:
parameter1.Value = Date.Today()
Actually I did that in visual studio and it worked well in preview (display the current date by default for the parameter and allow people to select other date) .
But for some reason, the subscription setting still asked me for the parameter value (as in the early post "Report Parameter Values").
On the report parameter configuration (on development time, not on the subscription creation), add a default value for the parameter. If you do, you will have a check box called "use default value" when creating the subscription
I tried it as well but it did not work for the subscription.
Sorry I can not attach the screen shot in the post currently.
In Subscription screen shows:
Report Parameter Values
Specify the report parameter values to use with this subscription.
Date To = Today()
Regards,
Helen
If you want to default the report parameter to the current date in the short format, you can set the default value of the parameter to the expression:
=CDate(FormatDateTime(Now, DateFormat.ShortDate))
精彩评论