简体   繁体   English

SSRS - 多值参数表达式

[英]SSRS - Multi Value Parameter Expression

I have the following Expression which should appear on the title of the report. 我有以下表达式,它应该出现在报告的标题上。 However, When I run this for a single entity which should fall under the else statement, It displays an error instead of the Label. 但是,当我为一个应该属于else语句的单个实体运行它时,它会显示错误而不是Label。

The Parameter is a multi value Parameter. 参数是一个多值参数。 And If I select 3 Parameters, it works fine, hence the else statement is working. 如果我选择3个参数,它工作正常,因此else语句正常工作。 But when I only select 1 value it returns an error. 但是当我只选择1个值时,它会返回错误。 What am I doing wrong. 我究竟做错了什么。

=IIF(
(Parameters!Parameter1.Count = 2 AND ((Parameters!Parameter1.Value(0)= 4589 AND Parameters!Parameter1.Value(1) = 4324) OR (Parameters!Parameter1.Value(1)= 4589 AND Parameters!Parameter1.Value(0)) = 4324)), "HLITE LLC",
JOIN(Parameters!Parameter1.Label," & ")
)

I also tried the following: 我也尝试过以下方法:

= SWITCH(
    Parameters!Parameter1.Count = 1 , lookup(Parameters!Parameter1.Value(0), Fields!Legal_Entity_ID.Value, Fields!Legal_Entity.Value, "DataSet2"),
    (Parameters!Parameter1.Count = 2 AND ((Parameters!Parameter1.Value(0)= 4589 AND Parameters!Parameter1.Value(1) = 4324) OR (Parameters!Parameter1.Value(1)= 4589 AND Parameters!Parameter1.Value(0)) = 4324)), "HHLITE"
)

This fails as well. 这也失败了。 But the look up expression by itself works AND COUNT IS 1 但查找表达式本身是有效的,而COUNT是1

I think the issue is that there is NOT a Value(1) when there's only 1 selection. 我认为这个问题是存在的值(1)如果只有1选择。

Maybe nesting IIF s would work: 也许嵌套IIF可行:

=IIF(Parameters!Parameter1.Count = 2,
     IIF((Parameters!Parameter1.Value(0)= 4589 AND Parameters!Parameter1.Value(1) = 4324) 
            OR (Parameters!Parameter1.Value(1)= 4589 AND Parameters!Parameter1.Value(0)) = 4324), 
        "HLITE LLC",
        JOIN(Parameters!Parameter1.Label," & "), 
    JOIN(Parameters!Parameter1.Label," & "))

This way, it only checks for value(1) if there are 2. 这样,它只检查值(1)是否有2。

If all else fails, 如果一切都失败了,

=IIF(JOIN(Parameters!Parameter1.Label," & ") = "4324 & 4589", "HLITE LLC", JOIN(Parameters!Parameter1.Label," & "))

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

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