简体   繁体   English

使用URL将多个值传递给SSRS中的下拉参数

[英]Passing multiple values using URL to a drop down parameter in SSRS

I am trying to pass multiple values for a parameter in ssrs which is delimited by ','.Limiting the result data set using where condition using split function in stored proc, this gives me results of my report data set 我正在尝试为ssrs中的一个参数传递多个值,该参数以','分隔。使用存储过程中的split函数使用where条件限制结果数据集,这为我提供了报告数据集的结果

WHERE YEAR(a.month_start_date)IN (SELECT Value FROM dbo.FnSplit(@year,','))
--AND datename(month,month_start_date) IN (SELECT Value FROM dbo.FnSplit(@month,','))
AND b1.branch_cd IN (SELECT Value FROM dbo.FnSplit(@branch,','))

I created a data set to get available values for year filter 我创建了一个数据集以获取年份过滤器的可用值

Configured the parameter to get available values from my filter data set and also checked option to "Allow multiple values" 配置参数以从我的过滤器数据集中获取可用值,并选中“允许多个值”选项

Select distinct year(month_start_date) as Year
From [DB].[dbo].[table]

Then I also limited my report data set to accept parameters with following condition.I configured parameter to accept the following value 然后我还将报告数据集限制为接受具有以下条件的参数。我将参数配置为接受以下值

=Join(Parameters!year.Value,",")

I pass in values in url 我在url中传递值

http://<servername>/ReportServer/Pages/ReportViewer.aspx?<reportname>rs:Command=Render&year=2012,2013,2014

My filter does not select the values passed thru the url. 我的过滤器未选择通过url传递的值。 The report only shows me the list of values in drop down but does not select the values parsed thru url 该报告仅显示下拉列表中的值列表,但未选择通过url解析的值

I am not sure if I am missing anything else. 我不确定是否还有其他东西。 Please suggest. 请提出建议。

Thanks! 谢谢!

The issue here is that your URL is constructed incorrectly. 这里的问题是您的URL构造不正确。 You are trying to pass througth the years as a single parameter and that isn't how it works. 您正在尝试将年限作为单个参数传递,但这不是它的工作原理。 Pass it through as a whole heap of parameters and then let the reporting server put it together and put it into the SQL. 将其作为整个参数堆传递,然后让报表服务器将其放在一起并放入SQL中。

Your URL should look like this (I changed the : to %3a and broke up the year parameter) 您的网址应如下所示(我将:更改为%3a并破坏了year参数)

http://<servername>/ReportServer/Pages/ReportViewer.aspx?<reportname>rs%3aCommand=Render&year=2012&year=2013&year=2014

I hope this helps someone out. 我希望这可以帮助某人。

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

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