简体   繁体   English

手动设置SSRS报表订阅参数,想设置参数为NULL

[英]Manually Setting SSRS Report Subscription Parameters and Want to Set a Parameter to NULL

I am manually setting and running an SSRS report subscription.我正在手动设置和运行 SSRS 报告订阅。 It has worked fine up until now, but I need to make a change to the report to set one of the parameters to NULL (this is a valid selection for the parameter to select "All" options of the parameter).到目前为止它运行良好,但我需要对报告进行更改以将参数之一设置为 NULL (这是参数的有效选择 select 参数的“所有”选项)。

I cannot figure out how to pass the parameter into the XML so that it is set to NULL for the report execution.我无法弄清楚如何将参数传递到 XML 以便将其设置为 NULL 以执行报告。 I can think of other workarounds by changing the report definition and underlying SQL queries, but was hoping to find a solution here first.我可以通过更改报告定义和底层 SQL 查询来考虑其他解决方法,但希望首先在这里找到解决方案。

eg The below statement does not work as it is just an empty string.例如,下面的语句不起作用,因为它只是一个空字符串。

UPDATE ReportServer.dbo.Subscriptions 
     SET parameters = '<ParameterValues><ParameterValue><Name>SomeParameter</Name><Value></Value></ParameterValue></ParameterValues>'
WHERE subscriptionid = @subscription_id

Found it out finally.终于找到了。 I just needed to exclude the <Value></Value> section entirely from the XML and it treats that as NULL.我只需要从 XML 中完全排除<Value></Value>部分,并将其视为 NULL。

UPDATE ReportServer.dbo.Subscriptions SET parameters = '<ParameterValues><ParameterValue><Name>SomeParameter</Name></ParameterValue></ParameterValues>' WHERE subscriptionid = @subscription_id

I discovered this by manipulating the subscription to look the way I wanted in the user interface and then examining the XML from the database.我通过操作订阅以在用户界面中查看我想要的方式发现了这一点,然后从数据库中检查 XML。

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

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