0
votes

I have tried nearly everything I can think of to get this to work, to no avail. I have a text box that I want the font color to be light gray if a certain value is true and black if it is false. Here are all the expressions that I've tried:

=IIF(Fields!is_hold.Value,"LightGrey","Black")
=IIF(Fields!is_hold.Value,"#d2d2d2","#000000")
=If(Fields!is_hold.Value,"LightGrey","Black")
=If(Fields!is_hold.Value,"#d2d2d2","#000000")
=IIF(True,"#d2d2d2","#000000")
=IIF(True,"LightGrey","Black")
=If(True,"LightGrey","Black")
=If(True,"#d2d2d2","#000000")
=SWITCH(True,"#d2d2d2",False,"#000000")
=SWITCH(True,"LightGrey",False,"Black")

The strange part is that it works fine on another subreport when I pass [is_hold] as a parameter:

=If(Parameters!IsHold.Value, "#d2d2d2", "#000000")

I have tried it in both Chrome and IE.

UPDATE: This only fails on text boxes. If I set the color of a line using the same expression, it works fine.

UPDATE 2: The problem exists on the server side. Previewing the form in Report Builder, the text colors exactly as it should. I checked the CSS classes that are auto-generated for the elements, and there is no color attribute when I use the expression. If I set the color directly, the color attribute exists in the CSS. Restarting SSRS service did not help.

1
you are missing the = - RoMEoMusTDiE
No, the value is a boolean. Also, see the example where I just used True. That should work regardless of the variable value. - Randy Slavey
i don't think so.... try equating it - RoMEoMusTDiE
See my update. The expression works on other elements, just not the text box. - Randy Slavey
Also, I have tried equating it. I've tried "= True", "= 1", "="true"", etc. - Randy Slavey

1 Answers

0
votes

Well, don't know what you are missing as I tried all possible scenarios (table, line, box, and textbox) with the following expression as the color expression and it all works fine for me.

=iif(Parameters!Bool.Value,"Red","Blue")

And the result is...

In dev:

enter image description here

And in deployed version:

enter image description here

Can you point at What I am missing so that I can try that bit too??

P.S.: Sorry as this not an answer but not able to comment in that much details.