我正在BIDS中建立一份SSRS报告。我需要让最终用户能够根据批准状态过滤报告。但是,每行有四个单独的批准列 - 我们称之为ApprovalA,ApprovalB,ApprovalC和ApprovalD;每个状态确定该行的整体状态。四个中的每一个都可以具有四个值中的一个 - 已批准,正在进行,已拒绝或不适用。我的方法是根据所有四列是否为Approved和N / A或Rejected和N / A的某种组合,或者In Progress是否在任何列中,创建派生列;然后我会根据派生列进行过滤。但是,每次运行报告时,都会收到错误消息:
“[rsRuntimeErrorInExpression]字段'Approval_Status'的值表达式包含错误:输入字符串的格式不正确。”
据我所知,我的查询应该有效,但它很复杂,我还是SSRS的新手。任何建议都会很精彩。我对派生列的表达式如下:
=Switch((Fields!ApprovalA.Value OR Fields!ApprovalB.Value OR Fields!ApprovalC.Value OR Fields!ApprovalD.Value) = "Accepted" OR (Fields!ApprovalA.Value OR Fields!ApprovalB.Value OR Fields!ApprovalC.Value OR Fields!ApprovalD.Value) = "N/A", "Accepted", (Fields!ApprovalA.Value OR Fields!ApprovalB.Value OR Fields!ApprovalC.Value OR Fields!IsPFApproved.Value) = "Rejected" OR (Fields!ApprovalA.Value OR Fields!ApprovalB.Value OR Fields!ApprovalC.Value OR Fields!ApprovalD.Value) = "N/A", "Rejected", (Fields!ApprovalA.Value OR Fields!ApprovalB.Value OR Fields!ApprovalC.Value OR Fields!ApprovalD.Value) = "In Progress", "In Progress")
答案 0 :(得分:1)
这样的事情可能起作用并复制你想要的逻辑:
=Switch(
(Fields!ApprovalA.Value = "Accepted" OR Fields!ApprovalA.Value = "N/A")
AND (Fields!ApprovalB.Value = "Accepted" OR Fields!ApprovalB.Value = "N/A")
AND (Fields!ApprovalC.Value = "Accepted" OR Fields!ApprovalC.Value = "N/A")
AND (Fields!ApprovalD.Value = "Accepted" OR Fields!ApprovalD.Value = "N/A")
, "Accepted",
(Fields!ApprovalA.Value = "Rejected" OR Fields!ApprovalA.Value = "N/A")
AND (Fields!ApprovalB.Value = "Rejected" OR Fields!ApprovalB.Value = "N/A")
AND (Fields!ApprovalC.Value = "Rejected" OR Fields!ApprovalC.Value = "N/A")
AND (Fields!ApprovalD.Value = "Rejected" OR Fields!ApprovalD.Value = "N/A")
, "Rejected",
Fields!ApprovalA.Value = "In Progress"
OR Fields!ApprovalB.Value = "In Progress"
OR Fields!ApprovalC.Value = "In Progress"
OR Fields!ApprovalD.Value = "In Progress"
, "In Progress"
)
你有语法错误;类似的东西:
(Fields!ApprovalA.Value
OR Fields!ApprovalB.Value
OR Fields!ApprovalC.Value
OR Fields!ApprovalD.Value) = "Accepted"
会导致错误,因为每个子句需要求值为布尔值;你不能那样嵌套这些字段。