简体   繁体   English

通过参数从数据集中具有多个值的 SSRS 表达式

[英]SSRS expression with multiple values from dataset via parameter

In my placeholder expression, I looking to pull multiple values from a dataset variable which relate to the parameter multiple selected values.在我的占位符表达式中,我希望从与参数多个选定值相关的数据集变量中提取多个值。 My parameter labels are locations (Location 1, Location 2, Location 3, etc...) and the parameter values are IDs (ID1, ID2, ID3, etc...).我的参数标签是位置(位置 1、位置 2、位置 3 等),参数值是 ID(ID1、ID2、ID3 等)。 In my dataset, I have abbreviated versions of the locations which is what I want to display in my SSRS report (Loc 1, Loc 2, Loc 3).在我的数据集中,我有位置的缩写版本,这是我想要在我的 SSRS 报告中显示的位置(Loc 1、Loc 2、Loc 3)。

I would like the values to be separated by a comma.我希望这些值用逗号分隔。

I know I can get the parameter labels with this code:我知道我可以使用以下代码获取参数标签:

=Join(Parameters!ParameterName.Label, ",")

So I tried something similar such as:所以我尝试了类似的东西,例如:

=Join((Fields!ABBREV.Value, ", "), "Dataset1")

and

=Join((Fields!ABBREV.Value,"Dataset1"), ", "), )

but neither worked但都没有奏效

In the end, I would like to see the list of abbreviated locations.最后,我想查看缩写位置列表。 For example, if the user selects Location 5, Location 7 and Location 9 in the parameter, my expression should show:例如,如果用户在参数中选择位置 5、位置 7 和位置 9,我的表达式应该显示:

loc 5, loc 7, loc 9

What is the right expression for this?什么是正确的表达方式? Thanks in advance.提前致谢。

EDIT SOLUTION:编辑解决方案:

This worked...这有效...

=JOIN(MULTILOOKUP(Parameters.ParameterName,Value. Fields,ID.Value, Fields,ABBREV,Value, "DataSet1"), ", ") =JOIN(MULTILOOKUP(Parameters.ParameterName,Value.Fields,ID.Value, Fields,ABBREV,Value, "DataSet1"), ", ")

I think it will work if you use LOOKUPSET.我认为如果您使用 LOOKUPSET 它将起作用。

=JOIN(LOOKUPSET(1, 1, Fields!ABBREV.Value, "DataSet1"), ", ")

Using 1 for the LOOKUP fields will return all records in Dataset1.对 LOOKUP 字段使用 1 将返回 Dataset1 中的所有记录。

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

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