简体   繁体   English

多值参数ssrs

[英]Multiple value parameter ssrs

I'm having a mental block here. 我在这里有精神障碍。 What I'm trying to do is allow the user to select 1 or multiple values for the parameter. 我正在尝试做的是允许用户为参数选择1个或多个值。

So here is my parameter allowed values @Group 所以这是我的参数允许值@Group

SELECT GROUPID,GroupName FROM dbo.tbl_Group WHERE GroupId In (1,7,11,12,14,15)

Users should be able to pick one or multiple values ie 1 or 1 and 7 so on. 用户应该能够选择一个或多个值,即1或1和7,依此类推。

My query is set to pick up the value of the parameter with this. 我的查询设置为此选择参数的值。

AllocatedGroup IN (@Group)

My problem is i can select multiple values and it works perfectly however if they select just 1 value it doesn't bring back any data 我的问题是我可以选择多个值,并且效果很好,但是如果他们只选择1个值,则不会带回任何数据

I can fix this by changing the query to say AllocatedGroup = (@Group) But that would remove the ability to select multiple values. 我可以通过将查询更改为AllocatedGroup = (@Group)来解决此问题,但这将消除选择多个值的能力。

Any help on this matter would be greatly appreciated. 在此问题上的任何帮助将不胜感激。

您可以使用OR并结合=和IN来匹配这两种情况。

WHERE GroupId IN (@group) OR GroupId = @group

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

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