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

时间:2018-02-23 14:43:06

标签: reporting-services reportbuilder3.0

我正在创建一个表达式来检查参数的值,然后根据传入的参数值显示一个文本字段。这是我目前的代码

=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", ""))), "")))

参数具有指定的值2,3和4.以及作为多值参数。该参数还涉及主数据集的过滤器表达式。

当前表达式适用于选择所有三个参数值以及选择任何两个参数值,但是,只要选择单个参数值,就会返回未定义的错误。该表达式位于我的报告的标题中,并且不允许任何故障/错误修复,因为未定义错误类型。

任何帮助总是受到赞赏!!

2 个答案:

答案 0 :(得分:0)

我最后只使用了三个带有可见性表达式的文本框来整理显示。现在一切都有效。

答案 1 :(得分:0)

假设您的参数标签是" Initial"," Review"和"结束"骗了......

enter image description here

那么你可以简单地做到这一点......

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