简体   繁体   English

如何在ssrs 2005报表中的非查询可用值中为多个值分配一个相同的标签?

[英]How to assign one same label for multiple value in non-queried available values in ssrs 2005 report?

Parameters - Multiple Values For One Label - Possible? 参数-一个标签有多个值-可能吗?

Sorry my modified Question..... 对不起,我修改过的问题.....

I have question to ask,... Is it possible to have multiple values for ONE label in non-queried available values in SSRS 2005? 我有一个问题要问,...在SSRS 2005中非查询可用值中是否可以为一个标签设置多个值? i want to join fields value in a single row like, 我想在单个行中加入字段值,

Works: (But this bring a long list in drop down menu - which i donot want)

Label                Value
---------------------------
Site-1                 150
Site-1                 151 
Site-2                 152
Site-2                 153


Required result (Which i want - in one line)

Label                Value
---------------------------
Site-1                 150,151
Site-2                 152,153
(which will bring one label and related multi-value in drop down or combo box.
But the problem is that ColumnName IN (@Site) does not work with multi-value.)

More description of the problem: 问题的更多描述:

Let say, I have a field/column 假设我有一个字段/列

 Name = Site
 Value = C150,C151, C152, C153

I want drop down menu on report with 我想在报表上使用下拉菜单

 C150,C151(as Site-1) & C152,C153(as Site-2)

So I created parameter ie @getSite and set values as multi-value in the report as 所以我创建了参数@getSite并将值设置为报表中的多值

 Label                       Value
 ---------------------------------------------
 Site-1                      (150,151)
 Site-2                      (152,153)

And set my parameter as @getSite:= Parameters!@getSite.Value And Query i wrote as, 并将我的参数设置为@getSite:= Parameters!@getSite.Value和我写成的查询,

SELECT  * FROM ..
WHERE Site IN (@getDisease)

But after all these, my report result is empty,literally no result. 但是毕竟,我的报告结果是空的,实际上没有结果。 It seems like if i select only one value as Site-1 = 150, then it works but not two or more values in one line, why it is not possible?? 似乎如果我只选择一个值作为Site-1 = 150,那么它行得通,但在一行中却没有两个或多个值,为什么这不可能呢? if yes then how? 如果是,那怎么办?

Please help!!! 请帮忙!!!

Yes just Right Click on your parameter in your Report Data window under Parameters folder and select the check box for allow multiple values as follows 是的,只需Right Click Report Data Parameters文件夹下Report Data窗口中的Parameters然后选中allow multiple values的复选框,如下所示

在此处输入图片说明

this is what I said before you need to put your column name inside a set of paranthesis something like this 这就是我所说的,然后您需要将列名放在一组类似的括号内

SELECT  * FROM ..
       WHERE (Site IN (@getDisease))

I have been working on this problem for a while and I think I have finally figured it out... 我已经在这个问题上研究了一段时间了,我想我终于知道了...

Basically you need to use a backwards case statement in your SELECT statement, put that in a derived query and then reference it in the outer WHERE clause.. 基本上,您需要在SELECT语句中使用向后的case语句,将其放在派生查询中,然后在外部WHERE子句中引用它。

SQL: SQL:

SELECT * FROM 
(
SELECT
Label
, value
, CASE WHEN [value] IN (150,151) THEN 'site-1' WHEN [value] IN (152,153) THEN 'site-2' END AS [grouped_values]
)
WHERE grouped_values IN (@getSite);

*Note: This answer only works on values that are mutually exclusive, if both sets had the same value included then it would be problematic.. *注意:此答案仅适用于互斥的值,如果两个集合都包含相同的值,则可能会出现问题。

-- Hopefully this can put you in the right direction. -希望这可以为您指明正确的方向。 I am finding a lot of the reporting services tricks require reverse engineering or at least some reverse thinking. 我发现许多报告服务技巧需要逆向工程或至少需要一些逆向思维。

cheers, Michael 干杯,迈克尔

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

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