Set the value of the reporting service parameter in the subscription as the current date

In SQL Server Reporting Services, when I created a subscription for a report with a parameter as a date type, I do not know how to set the parameter value as the current date (wherever the subscription is performed).

I'm tired today (), today, today, @ExecutionTime. But none of them worked for me. Only a specific work date, for example: "11/11/2010 00:00:00".

I also tried to hide this parameter, but the index still had to populate this parameter. For the text field "default value", the value "Today ()", "Today", etc. is not allowed.

Thanks in advance!

Helen

+6
sql parameters reporting-services
source share
8 answers

You need = make expressions

 = Today() 
+4
source share

You cannot put "= today ()" on the command line at run time. You must set the default value of the parameter as "= today ()" in visual studio.

+4
source share

Try connecting to Driven data and passing an SQL statement to return the current date for the parameter value.

+2
source share

In my case, the following code worked:

 parameter1.Value = Date.Today() 
+1
source share

I tried too, but it did not work for a subscription.

Sorry, I cannot attach a screenshot in the message at the moment.

The "Subscription" window shows: Report parameter values
Specify report parameter values ​​for use with this subscription.
Date To = Today ()

Hi,

Helen

0
source share

Actually, I did it in visual studio, and it worked well in the preview (it displays the current default date for the parameter and allows people to choose a different date).

But for some reason, the subscription parameter still gave me the value of the parameter (as in the early message “Report parameter values”).

0
source share

In the report parameter configuration (during development, and not when creating a subscription), add a default value for the parameter. If you do this, you’ll see the “Use default value” checkbox when creating a subscription

0
source share

If you want to specify the report parameter for the current date in short format by default, you can set the default value for the parameter:

= CDate (FormatDateTime (now, DateFormat.ShortDate))

0
source share

All Articles