Reporting Services:使用链接的报表中的表达式覆盖默认参数
所以我在SSRS 2005中有一个每日仪表板报告。它有一个参数@pDate,默认为 = Now。
So I've got a "daily dashboard" report in SSRS 2005. It has a parameter, @pDate, which defaults to "=Now".
I希望在链接的报告中使用相同的报告来显示昨天的最终仪表板(然后将通过订阅将其发送出去),并使用另一个表达式 = dateadd(d,-1,Now)覆盖默认参数。但是,当我更改默认参数时,会出现数据不匹配错误(natch)。
I'd like to use this same report in a linked report to show yesterday's final dashboard (which would then be mailed out via subscription), and override the parameter default with another expression, "=dateadd(d,-1,Now)." But when I change the default parameter, I get a data mismatch error (natch).
我假设这是行的结尾,我只需要部署一个每日仪表盘报告的副本,默认为昨天的@pDate,但我想我会在这里发布,看看是否有人在不需要维护两个RDL的情况下可以通过一些捷径来实现此目的。
I'm assuming that's the end of the line and I just need to deploy a copy of the daily dashboard report with a default @pDate of yesterday, but I thought I'd post here and see if anybody had some nifty shortcut to accomplish this without having to maintain two RDLs.
更新:我在 MSDN 中找到了这个: / p>
UPDATE: I found this on MSDN:
如果默认值接受一个值,则您
可以输入对数据处理有效的
常量或语法与报告一起使用的
扩展名。
If Default Value accepts a value, you can type a constant or syntax that is valid for the data processing extension used with the report.
数据处理扩展名显然可以转换为SQL Server,因此我尝试了有效的单例选择不是常量(GETDATE(), 04/27 / + YEAR(GETDATE())等),但仍然没有。
"Data processing extension" apparently translates to SQL server, so I tried valid singleton selects that weren't constants (GETDATE(), "04/27/"+YEAR(GETDATE()), etc...) and still nothing.
所以我发现了我的问题:如果您的主报表中有子报表正在使用主报表中的传递参数,请确保子报表中的所有参数都使用相同的数据类型。我的两个子报表使用@pDate字段而不是DateTime的String数据类型,因此订阅失败(尽管由于某些原因,报表的实时版本可以忍受这种不一致。)
So I found out my issue: if you have subreports within your main report that are using passthrough parameters from the main report, make sure that all of your parameters in your subreports are using the same data type. Two of my subreports were using a String datatype for the @pDate field instead of DateTime, so the subscription was failing (although for some reason the live version of the report tolerates this inconsistency.)
我现在正在使用数据驱动的订阅来动态设置@pDate,一切似乎都工作正常。
I am now using a data-driven subscription to set @pDate dynamically and everything seems to be working fine.