Need help in giving the expression for background color for a column

  • Hi All,

    I have a column 'RunTime' with following format of data in it. I need to give an expression for back ground color of this column as 'RED' if the RunTime >= 2 Hrs

    For my earlier reports I was using = IIF(Fields!Runtime.Value > 2,"RED","SpringGreen") and it used to work. but I guess that because the column format was integer.

    Can someone please help ASAP. Need to get this done tonight.

    Thanks in Advance.

  • Could you not format out in the data set an int based column which is used in the expression, but not shown in the report?

  • sorry for confusion. here is what the column looks like.

    22 Hrs : 34 Mins

    16 Hrs : 34 Mins

    8 Hrs : 35 Mins

    0 Hrs : 36 Mins

    Now i need to put red color for the ones that are >= 2 Hrs

  • Is there a way that I can take only the first digit of the column and see if its >= 2 and mark it as red color in the expression?

  • That was just my thought. I mean please share your idea how mark the background color as red.

  • Could you not get left 1, convert it to int, then do > 2

    CInt(Left(Fields!Field.Value,1)) > 2

  • How can I add a condition to the below expression? Please help

    (CInt(Left(Fields!Runtime.Value,1)) >= 2,"Red"),"Transparent"

  • You would just build that into your background expression as you have done

    =IIF( CInt( Left(Fields!Runtime.Value,1)) >= 2,"Red","Transparent")

  • That worked thanks a lot. You saved me big time tonight..

  • Doh moment

    LEFT("16",1) = 1 which doesnt match the value as that should go red, do left 2, so change it to CInt(REPLACE(LEFT(Fields!Field.Value,2)," ","")), that way if it picks "1 " or "0 " it will remove the space and do the correct comparission

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply