Reputation: 815
I am working on an expression which will change the cell background color based on the values of two different columns. One column being a percentage and the other a number representing file size (gb)
Note: Column names are Free_Space and Free_Space__ (ssrs doesnt like % sign apparently)
Here is the expression
=Switch((Fields!Free_Space__.Value >= 20), "Lime", (Fields!Free_Space.Value > 50) AND (Fields!Free_Space__ > 10), "Lime", (Fields!Free_Space.Value > 50) AND (Fields!Free_Space__ < 10), "Orange", (Fields!Free_Space.Value < 50) AND (Fields!Free_Space__ > 10), "Orange", (Fields!Free_Space.Value < 50) AND (Fields!Free_Space__ < 10), "Red")
For some reason when I try previewing the report in SSRS I am getting the following error:
Compiler Error Message: BC30452: Operator '>' is not defined
Can anyone see what is wrong with my expression? I truly do not understand where I am going wrong.
Thanks all.
Upvotes: 0
Views: 1621
Reputation: 6734
You are missing the.Value properties from !Free_Space__. Without them, it believes that you are trying to compare objects (is this object greater than 10? impossible to tell).
Try this instead:
=Switch((Fields!Free_Space__.Value >= 20), "Lime", _
(Fields!Free_Space.Value > 50) AND (Fields!Free_Space__.Value > 10), "Lime", _
(Fields!Free_Space.Value > 50) AND (Fields!Free_Space__.Value < 10), "Orange", _
(Fields!Free_Space.Value < 50) AND (Fields!Free_Space__.Value > 10), "Orange", _
(Fields!Free_Space.Value < 50) AND (Fields!Free_Space__.Value < 10), "Red")
Upvotes: 1