简体   繁体   English

SSRS订阅无法识别我定义的日期参数默认值

[英]SSRS subscription is not recognising a date parameter default that I have defined

I have a report with 2 parameters, @startdate and @enddate , which are date/time format. 我有一个带有2个参数的报告, @startdate@enddate ,它们是日期/时间格式。 When the report runs, you choose the date from a calendar. 报告运行时,您可以从日历中选择日期。 I deploy the report to report server running SQL Server 2012 Report Server. 我将报表部署到运行SQL Server 2012报表服务器的报表服务器。

I've now set default values for the two parameters, as I want to set the range to be the beginning of this year to today. 我现在为这两个参数设置了默认值,因为我要将范围设置为从今年年初到今天。 I set the default values as follows in the parameter properties in Visual Studio, using "specify values": 我使用“指定值”在Visual Studio的参数属性中设置默认值,如下所示:

@startdate is set as 01/02/2013 00:00:00 @startdate设置为01/02/2013 00:00:00
@enddate is set as an expression =today() @enddate设置为表达式=today()

When I preview the report locally in Visual Studio, it correctly fills the two parameters as I would expect. 当我在Visual Studio中本地预览报表时,它可以正确填充两个参数。 I deploy to the report server, and go in to Report Manager to create a subscription, but it doesn't have a "use default" next to the startdate parameter box. 我部署到报表服务器,并进入报表管理器创建订阅,但它并没有“使用默认值”旁边的startdate参数框。 I also notice that the enddate parameter box has "use default" selected, but this and the input box are greyed out. 我还注意到enddate参数框已选择“使用默认值”,但此框和输入框均为灰色。

At first I thought it was an issue with the subscription set up, but when I run the deployed report from the report manager (and from a sharepoint page), it doesn't use my default value for the start date, and it is not until I choose a start date manually that it sets the enddate to today's date. 最初,我认为这与订阅设置有关,但是当我从报表管理器(和共享点页面)运行已部署的报表时,它没有使用默认值作为开始日期,因此它不是直到我手动选择开始日期为止,它将开始日期设置为今天的日期。

I can use an expression to return a specific date as a workaround, but my question here is why does the deployed report not recognise this default parameter when the locally run report does recognise it? 我可以使用表达式返回特定日期作为解决方法,但是我的问题是,当本地运行的报表可以识别默认参数时,为什么部署的报表不能识别该默认参数?

Just check a couple of things, as this should work, I do it all the time. 只需检查几件事,因为这应该起作用,所以我一直都这样做。

Make sure the report parameter is of type Date/Time and that it has a default value. 确保报告参数的类型为日期/时间,并且具有默认值。 This should already be the case as you can run it from VS and the defaults are visible. 这种情况应该已经存在,因为您可以从VS运行它,并且默认值是可见的。

Next navigate to the report server through the browser, find the report's rdl file, right click (or down arrow) -> Manage. 接下来,通过浏览器导航到报表服务器,找到报表的rdl文件,右键单击(或向下箭头)->管理。 Select the Parameters tab and make sure the HAS DEFAULT boxes are ticked, then click accept. 选择“参数”选项卡,并确保选中“ HAS DEFAULT”框,然后单击“接受”。 When you upload the report for the first time it saves the parameters, if you then change the parameters in VS and upload again it doesnt seem to override the initial parameters. 首次上载报表时,它会保存参数,如果您随后在VS中更改参数并再次上载,则它似乎不会覆盖初始参数。 I always double check datasource and parameters after an upload. 上传后,我总是会仔细检查数据源和参数。

Next go to the subscription tab, edit the subscription, at the bottom you'll see Report Parameter Values, the start date and end date parameter textboxes should be greyed out and next to it the box USE DEFAULT should be ticked. 接下来转到订阅选项卡,编辑订阅,在底部,您将看到“报告参数值”,开始日期和结束日期参数文本框应显示为灰色,并在其旁边的“使用默认值”框内打钩。

Hope this helps you in finding the problem. 希望这有助于您发现问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM