SSRS嵌套IIF在Switch语句中

时间:2015-03-11 06:29:56

标签: sql-server reporting-services

想知道为什么IIF语句在Switch语句中不起作用。任何人都可以帮助我,因为我无法弄清楚代码中的错误。或者将IIF放在Switch语句中是否有效?

=Switch(
Ucase(Parameters!GroupBy.Value) = "ORGANIZATIONUNIT", 
         IIF(PREVIOUS(Fields!PersonID.Value) = Fields!PersonID.Value 
                AND PREVIOUS(Fields!OrganizationUnitID.Value) = Fields!OrganizationUnitID.Value
                                , ""
                                ,Fields!LastName.Value),
Ucase(Parameters!GroupBy.Value) = "LEARNINGRESOURCE",
        IIF(PREVIOUS(Fields!PersonID.Value) = Fields!PersonID.Value 
                AND PREVIOUS(Fields!LearningResourceID.Value) = Fields!LearningResourceID.Value
                                , ""
                                ,Fields!LastName.Value),
Ucase(Parameters!GroupBy.Value) = "SSRS.PROMPTS.LRCATEGORYID",
        IIF(PREVIOUS(Fields!PersonID.Value) = Fields!PersonID.Value 
                AND PREVIOUS(Fields!LearningResourceCategoryID.Value) = Fields!LearningResourceCategoryID.Value
                                , ""
                                ,Fields!LastName.Value),
Ucase(Parameters!GroupBy.Value) = "REPORTINGCATEGORY",
        IIF(PREVIOUS(Fields!PersonID.Value) = Fields!PersonID.Value 
                AND PREVIOUS(Fields!LearningResourceReportingCategoryID.Value) = Fields!LearningResourceReportingCategoryID.Value
                                , ""
                                ,Fields!LastName.Value),
Ucase(Parameters!GroupBy.Value) = "SUPERVISOR",IIF(PREVIOUS(Fields!PersonID.Value) = Fields!PersonID.Value 
                AND PREVIOUS(Fields!SupervisorPersonID.Value) = Fields!SupervisorPersonID.Value
                                , ""
                                ,Fields!LastName.Value),
                TRUE
                , IIF(PREVIOUS(Fields!PersonID.Value) = Fields!PersonID.Value
                    , ""
                    ,Fields!LastName.Value)
)

0 个答案:

没有答案