conditional formatting

  • 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.

  • 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.:-)

  • Something that may have been a typo, but if you copied your code directly, shouldn't "red" be "Red"?

    Steve.

  • 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")

  • hmm..

    i tried all the suggestions, but nothing works.

    I dont understand what's going on.

    Thanks,

  • 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.

  • 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

  • even converting to an integer CInt(-10) did not work

  • 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.

  • 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