简体   繁体   English

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

[英]Change SSRS expression used based on parameter value

I have an SSRS expression that i need to change the values in based on a passed parameter. 我有一个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))

My parameter is an int and based on either 1,2,3 or 4. I need to change the third line of the expression. 我的参数是int,基于1,2,3或4。我需要更改表达式的第三行。 I have tried to wrap the entire expression in an IIF and I was not able to run the report. 我试图将整个表达式包装在IIF中,但无法运行该报告。 What im thinking is 我在想什么

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

which is basically adding the Parameters.Value right at the top. 这基本上是在顶部添加Parameters.Value。 Has anyone had any success or a better way to change what expression is being used? 有没有人成功或有更好的方法来更改正在使用的表达方式?

When I took your Expression in notepad and checked bracktes, it did not matched. 当我将您的表情放在记事本中并检查了花括号时,它不匹配。 I reworked your expression and I could find 1 false expression been missing from your expression. 我重新整理了您的表情,发现您的表情中缺少1个错误的表情。 You might want to check that. 您可能要检查一下。 Below is the expression I created from your example. 以下是我根据您的示例创建的表达式。

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

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

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