=IIF([boolean],[return value if true],[return value if false])A problem lies in the fact that both the true and the false part are obligatory. For setting the color the following IIF-statement can be used:
=IIF(ReportItems!txtBox.Value=5, "Palegreen", "Transparent")But, the value Transparent does not exist! You cannot set it! Visual Studio throws the following warning:
The value of the background color property for the textbox ‘textbox’ is “Transparent”, which is not a valid background color.It turns out that this property is not exported to the generated XML file, called rdl, if it is not explicitly set. The IIF-statement forces you to set it, but the value Transparent cannot be used. How to dynamically set the color property then?
You could use the value White instead. However, the background color for example gets rendered after the borders, so a white background covers part of a visible cell border. This is clearly visible on the report. Very annoying...
The only solution I could come up with is using a function that does not have an explicit return type. Then, if there is no return value, a non-existing object is returned.
Like this:
function Rank(val1)Can you have the IIF-statement return a null (uninitialized object) value? The System.DBNull value that has replace the null value is just a type, not a value. So, this doesn't work.
if val1=5 then Rank = "Palegreen"
end function
1 comment:
Maybe if you try the Switch command instead of IIF?
Greets,
Post a Comment