Dinesh
Dinesh

Reputation: 75

SSRS iif condition failing

My requirement - If condition satisfy then ID column should be blue else black

Blue color = type="NY" and isact=true and eqe=true

Blue color = type="CAL" and isact=true

black color = type="NY" and isact=false and eqe=false

black color = type="NY" and isact=false and eqe=true

black color = type="NY" and isact=true and eqe=false

black color = type="CAL" and isact=false

=IIf(Fields!IsAct.Value = True,
     IIf(Fields!EQE.Value = True,
         IIf(Fields!Type.Value = "NY",  "Blue","Black"),"Black"), "Black")
  or 
  IIf(Fields!IsAct.Value = False,
     IIf(Fields!Type.Value = "CAL",  "Black","Blue"), "Black")

I have this logic in font ID column. If I run above individually then its working but if i combine its not working. Any help is really appreciate.

Upvotes: 0

Views: 118

Answers (1)

Steve-o169
Steve-o169

Reputation: 2146

This is looking very complex and I think there's a cleaner way to do this with a SWITCH statement. I believe the following expression should work well.

=SWITCH(
        Fields!Type.Value = "NY" AND Fields!IsAct.Value AND Fields!EQE.Value, "Blue",
        Fields!Type.Value = "CAL" AND Fields!IsAct.Value, "Blue",
        Fields!Type.Value = "CAL" AND NOT Fields!IsAct.Value, "Black",
        Fields!Type.Value = "NY" AND NOT Fields!IsAct.Value AND NOT Fields!EQE.Value, "Black",
        Fields!Type.Value = "NY" AND NOT Fields!IsAct.Value AND Fields!EQE.Value, "Black",
        Fields!Type.Value = "NY" AND Fields!IsAct.Value AND NOT Fields!EQE.Value, "Black",
        True, "Black")

So I think that expression handles all of the cases you provided, but if I'm reading correctly, you really only have 2 conditions that set the color to blue, otherwise it is black. So the following should work just as well.

= IIF((Fields!Type.Value = "NY" AND Fields!IsAct.Value AND Fields!EQE.Value) 
        OR (Fields!Type.Value = "CAL" AND Fields!IsAct.Value), "Blue", "Black")

Upvotes: 2

Related Questions