【问题标题】:Cascading parameter in SSRS(Visual Studios 2012) not working with multiple valuesSSRS(Visual Studios 2012)中的级联参数不适用于多个值
【发布时间】:2014-04-08 23:34:28
【问题描述】:

所以我正在编写一份包含多个参数的报告。在大多数情况下,除了这个参数(我将其称为parameter A)之外,我的所有功能都可以正常工作。基本上,参数 A 是根据其他两个参数过滤的用户名列表:时期参数(即 2013 年或 2014 年)和 国家参数 (2 = 美国,3 = 英国等)。

参数 A 是一个级联参数,其数据集依赖于先前的参数。用户可以在period参数中选择时间段(该参数不允许多值选择),在country参数中选择国家(允许多值选择) )。

参数A的数据集中,我有这个where子句:

where u.username is not null  
and c.period = @period  
and c.Country_ID = @Country_ID

因此,当用户选择一个国家/地区时,报告工作正常……但如果他们选择多个国家/地区,报告就会中断。我可以用 SQL 代码或 SSRS 做些什么来让用户选择多个国家而不破坏报告吗?

【问题讨论】:

    标签: sql sql-server visual-studio-2012 reporting-services


    【解决方案1】:

    您需要实现一个可以使用逗号分隔参数的拆分函数。所以你的 where 子句会更像:

    where u.username is not null
    and c.period=@period
    and c.CountryID in (SELECT item from [fn_split](@Country_ID))
    

    查看这篇文章了解更多信息:Split Function

    【讨论】:

    • 您好,感谢您的回复。离开你写的内容,我尝试了“and (c.Country_ID in (@Country))”并且由于某种原因有效。感谢您的帮助!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-27
    • 1970-01-01
    • 2013-09-01
    • 1970-01-01
    相关资源
    最近更新 更多