根据参数值更改使用的 SSRS 表达式

Change SSRS expression used based on parameter value

我有一个 SSRS 表达式,我需要根据传递的参数更改其中的值。

="Double Coat " & 
IIF((First(Fields!rr_paintpayout.Value, "Market") = "Task-Based") OR (First(Fields!rr_paintpayout.Value, "Market") = "Hourly"),
    IIF(Fields!rr_taskpayoutaddonoption.Value = "Floorplan Configuration",
        Fields!rr_1x1.Value & " - "& Fields!rr_1x4.Value**,
        IIF(Fields!rr_taskpayoutaddonoption.Value = "Fixed Quantity",
            Fields!rr_fixedamount.Value & " each",
            IIF(Fields!rr_taskpayoutaddonoption.Value = "Fixed Hourly",
                Fields!rr_fixedamount.Value & " hourly",
                Fields!rr_fixedamount.Value))),
    IIF(First(Fields!rr_paintpayout.Value, "Market") = "Variable Percent",
        IIF(Fields!rr_variablepercentaddonselection.Value = "Sq Ft Variable Pricing",
            Fields!rr_fixedamount.Value & " sq. ft.",
            IIF(Fields!rr_variablepercentaddonselection.Value = "Fixed Quantity",
                Fields!rr_fixedamount.Value & " each",
                IIF(Fields!rr_variablepercentaddonselection.Value = "Fixed Hourly",
                    Fields!rr_fixedamount.Value & " hourly",
                    Fields!rr_fixedamount.Value))), 0.00))

我的参数是一个整数,基于 1、2、3 或 4。我需要更改表达式的第三行。我试图将整个表达式包装在 IIF 中,但无法 运行 报告。我的想法是

  ="Double Coat " & 
    IIF((First(Fields!rr_paintpayout.Value, "Market") = "Task-Based") OR (First(Fields!rr_paintpayout.Value, "Market") = "Hourly"),
        IIF(Fields!rr_taskpayoutaddonoption.Value = "Floorplan Configuration",
      IIF((Parameters.Bedrooms.Value =1 )
            Fields!rr_1x1.Value & " - "& Fields!rr_1x4.Value)),
 IIF((Parameters.Bedrooms.Value =2 )
            Fields!rr_2x1.Value & " - "& Fields!rr_3x4.Value)),
            IIF(Fields!rr_taskpayoutaddonoption.Value = "Fixed Quantity",
                Fields!rr_fixedamount.Value & " each",
                IIF(Fields!rr_taskpayoutaddonoption.Value = "Fixed Hourly",
                    Fields!rr_fixedamount.Value & " hourly",
                    Fields!rr_fixedamount.Value))),
        IIF(First(Fields!rr_paintpayout.Value, "Market") = "Variable Percent",
            IIF(Fields!rr_variablepercentaddonselection.Value = "Sq Ft Variable Pricing",
                Fields!rr_fixedamount.Value & " sq. ft.",
                IIF(Fields!rr_variablepercentaddonselection.Value = "Fixed Quantity",
                    Fields!rr_fixedamount.Value & " each",
                    IIF(Fields!rr_variablepercentaddonselection.Value = "Fixed Hourly",
                        Fields!rr_fixedamount.Value & " hourly",
                        Fields!rr_fixedamount.Value))), 0.00))

基本上是在顶部添加 Parameters.Value。有没有人成功或有更好的方法来更改正在使用的表达式?

当我把你的表情放在记事本里检查括号时,它不匹配。 我修改了你的表情,发现你的表情中少了 1 个错误的表情。你可能想检查一下。下面是我根据您的示例创建的表达式。

="Double Coat " & IIF(First(Fields!rr_paintpayout.Value, "Market") = "Task-Based" OR First(Fields!rr_paintpayout.Value, "Market") = "Hourly",
IIF(Fields!rr_taskpayoutaddonoption.Value = "Floorplan Configuration",
IIF(Parameters.Bedrooms.Value =1,
Fields!rr_1x1.Value & " - "& Fields!rr_1x4.Value,
IIF(Parameters.Bedrooms.Value =2 ,
Fields!rr_2x1.Value & " - "& Fields!rr_3x4.Value,
IIF(Fields!rr_taskpayoutaddonoption.Value = "Fixed Quantity",
Fields!rr_fixedamount.Value & " each",
IIF(Fields!rr_taskpayoutaddonoption.Value = "Fixed Hourly",
Fields!rr_fixedamount.Value & " hourly",Fields!rr_fixedamount.Value)))),
IIF(First(Fields!rr_paintpayout.Value, "Market") = "Variable Percent",
IIF(Fields!rr_variablepercentaddonselection.Value = "Sq Ft Variable Pricing",
Fields!rr_fixedamount.Value & " sq. ft.",
IIF(Fields!rr_variablepercentaddonselection.Value = "Fixed Quantity",
Fields!rr_fixedamount.Value & " each",
IIF(Fields!rr_variablepercentaddonselection.Value = "Fixed Hourly",
Fields!rr_fixedamount.Value & " hourly",Fields!rr_fixedamount.Value))),
false)),
0.00)