gpt4 book ai didi

sql - SSRS 报告 - IIF 声明问题

转载 作者:行者123 更新时间:2023-12-04 17:27:55 25 4
gpt4 key购买 nike

做一个表达式我得到一个错误,有人可以在这里告诉我正确的语法吗?

=IIf(Fields!t_cpcp.Value ="310", "Purchased Material & Raw Material", Nothing)
=IIf(Fields!t_cpcp.Value ="320", "Manufacturing Direct Labor", Nothing)
=IIf(Fields!t_cpcp.Value ="325", "Subcontract Cost", Nothing)
=IIf(Fields!t_cpcp.Value ="330", "Engineering Direct Labor", Nothing)
=IIf(Fields!t_cpcp.Value ="340", "Manufacturing Labor O/H", Nothing)
=IIf(Fields!t_cpcp.Value ="345", "Engineering Labor O/H", Nothing)
=IIf(Fields!t_cpcp.Value ="350", "Material O/H", Nothing)
=IIf(Fields!t_cpcp.Value ="355", "Labor O/H Surcharge", Nothing)
=IIf(Fields!t_cpcp.Value ="360", "Subcontract Material Burden", Nothing)
=IIf(Fields!t_cpcp.Value ="MFD", "Manufactured Items", Nothing)

最佳答案

如果您希望所有这些都在一个表达式中,您可能需要使用 SWITCH 语句:

=Switch(<condition>, <return value if true>, <next condition>, <return value if true>, ...)

switch 语句将返回为真的第一个条件的值。使用您的示例,您可以尝试:
=Switch(Fields!t_cpcp.Value ="310", "Purchased Material & Raw Material",
Fields!t_cpcp.Value ="320", "Manufacturing Direct Labor",
Fields!t_cpcp.Value ="325", "Subcontract Cost",
...rest of them go here...)

关于sql - SSRS 报告 - IIF 声明问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4879706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com