简体   繁体   English

IIf语句中嵌入了具有多值参数的SSRS表达式字段

[英]SSRS Expression Field with Multi-value parameter embedded in IIf Statement

I am working on creating an expression to check the value of a parameter and then display a text field based upon the value of the passed in parameter. 我正在创建一个表达式来检查参数的值,然后根据传入的参数的值显示一个文本字段。 Here is my current code 这是我当前的代码

=IIf(Parameters!AssessmentType.Count = 3, "All Assessments",
IIf(Parameters!AssessmentType.Count = 2, IIf(Parameters!AssessmentType.Value(0) = 2 AND 
Parameters!AssessmentType.Value(1) = 3, "Initial and Review Assessments", 
IIf(Parameters!AssessmentType.Value(0) = 2 And Parameters!AssessmentType.Value(1) = 4, 
"Initial and Closing Assessments", IIf(Parameters!AssessmentType.Value(0) = 3 
And Parameters!AssessmentType.Value(1) = 4, "Review and Closing Assessments", 
IIf(Parameters!AssessmentType.Value(0) = 3 And 
Parameters!AssessmentType.Value(1) = 2, "Initial and Review Assessments", 
IIf(Parameters!AssessmentType.Value(0) = 4 And Parameters!AssessmentType.Value(1) = 2, 
"Initial and Closing Assessments", IIf(Parameters!AssessmentType.Value(0) = 4 
And Parameters!AssessmentType.Value(1) = 3, "Review and Closing Assessments","")))))), 
IIf(Parameters!AssessmentType.Count = 1, IIf(Parameters!AssessmentType.Value(0) = 2, 
"Initial Assessments", IIf(Parameters!AssessmentType.Value(0) = 3, "Review Assessments", 
IIf(Parameters!AssessmentType.Value(0) = 4, "Closing Assessments", ""))), "")))

The parameter has specified values of 2, 3, and 4. As well as being a multi-valued parameter. 该参数具有2、3和4的指定值。它也是一个多值参数。 The parameter is also involved in a filter expression for the main dataset. 该参数还包含在主数据集的过滤器表达式中。

The current expression works for having all three parameter values selected as well as having any two parameter values selected, however, whenever a single parameter value is selected, an undefined error is returned. 当前表达式可用于选择所有三个参数值以及选择任何两个参数值,但是,每当选择一个参数值时,都会返回未定义的错误。 The expression is sitting in the header of my report and does not allow for any trouble/bug fixing as the error type is not defined. 该表达式位于我报告的标题中,并且由于未定义错误类型,因此不允许进行任何故障/错误修复。

Any help is always appreciated!! 任何帮助总是感激不尽!

I ended up just using three different text boxes with visibility expressions to sort out the display. 我最终只使用了三个带有可见性表达式的文本框来整理显示内容。 Everything works now. 现在一切正常。

Assuming that your parameters labels are "Initial", "Review" and "Closing" liek this... 假设您的参数标签为“初始”,“审阅”和“关闭”,则可以这样...

在此处输入图片说明

Then you could simply do this... 然后您可以简单地执行此操作...

= IIF(
        Parameters!AssesmentType.Count = 3,
        "All",
        JOIN(Parameters!AssesmentType.Label, " and ") 
    )
    & " Assesments"

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

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