August 14, 2009 at 7:50 am
Hi All,
I am implementing conditional formatting based on a textbox.
if textbox.value > 0 , Green
textbox.value <=0 and textbox.value >= -10 , Orange
textbox.value < -10 , Red.
I am currently using the following switch expression in the color property,
=switch(
reportitems!textbox13.Value>0,"Green"
,reportitems!textbox13.Value=0,"Orange"
,reportitems!textbox13.Value >= -10 , "Orange"
,reportitems!textbox13.Value < -10,"red")
This is not giving expected output.
I see green for anything > 0, but everything else is orange
even -80 is in orange. It's not coming in red.
Please advice,
Thanks.
August 14, 2009 at 8:37 am
Hi,
I think you need to use a nested iif statement something like the following can be used:
=iif(Fields!Count.Value >0,"Green",
iif(Fields!Count.Value =0, "orange",
iif(Fields!Count.Value >-10, "orange",
"red")))
This should work, let me know how you get on.:-)
August 14, 2009 at 8:52 am
Something that may have been a typo, but if you copied your code directly, shouldn't "red" be "Red"?
Steve.
August 14, 2009 at 9:26 am
I find that your posted code works as you want, so there may be something else going on. One thing you could try is taking advantage of a default condition in Switch. Switch will return the first result that returns true, so the following statement works the same as yours.
=switch(reportitems!textbox13.Value>0,"Green",reportitems!textbox13.Value<-10,"Red",1=1,"Orange")
August 14, 2009 at 9:52 am
hmm..
i tried all the suggestions, but nothing works.
I dont understand what's going on.
Thanks,
August 14, 2009 at 10:15 am
You could try creating another temporary textbox with a value of =reportitems!textbox13.Value < -10 and see if it is evaluating to True when the value of textbox13 is -80. If it is not, maybe the negative sign is somehow making it be interpreted as a string and you will have to force it to int with CInt(). Just a thought.
August 14, 2009 at 10:29 am
Thanks David,
Thanks every one
i ll give it a try and let you all know.
I already tried (10) instead of -10 but no success..
Will keep u posted soon
Thanks all again
August 14, 2009 at 10:35 am
even converting to an integer CInt(-10) did not work
August 14, 2009 at 12:16 pm
Hmm. Did the temporary textbox with =reportitems!textbox13.Value < -10 return True when the value is -80?
You may look through the rdl code itself and search for textbox13 and see if you notice anything strange wherever that is referenced.
August 17, 2009 at 9:56 am
I am afraid there is no sucess on this one yet.
I have tried the following the expression on a different machine
and it worked, but doesn't work on my development machine.
=switch(reportitems!textbox1.Value>0,"Green"
,reportitems!textbox1.Value< -10,"Red"
,1=1,"Orange")
Will there be any settings i shud look for?
Thanks,
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply