Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS Report - IIF statement Question

Doing an expression I get an error, can someone show me the correct syntax here?

=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)
like image 406
GabrielVa Avatar asked Feb 02 '11 20:02

GabrielVa


1 Answers

If you want this to all be in one expression, you may want to use the SWITCH statement:

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

The switch statement will return the value for the first condition that is true.Using your example, you could try:

=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...)
like image 187
Joel Beckham Avatar answered Sep 29 '22 02:09

Joel Beckham