changing the color of the text in rows based on a condition

  • =Iif

    (

    (DateDiff("m",CDate(Fields!ActsDate.Value),CDate(Fields!ItemDate.Value))>=6

    Or

    (DateDiff("m",CDate(Fields!ActsDate.Value),CDate(Fields!DecisionDate.Value))>=6,"Red","Black"

    )

    I am using this expression for changing the color...

    Help me how to change the color of the row if the date diff between 2 columns dates > 6 months

    thanks in advance

  • Trying using a switch Case Like Below

    =Switch(DateDiff("m",CDate(Fields!ActsDate.Value),CDate(Fields!DecisionDate.Value))>=6,"Red",DateDiff("m",CDate(Fields!ActsDate.Value),CDate(Fields!DecisionDate.Value))>=6,"Black")

  • Thanks

    It doesnt work

  • Try the following modification to the Switch statment (changed the arithmetic operators)

    =Switch(DateDiff("m",CDate(Fields!ActsDate.Value),CDate(Fields!DecisionDate.Value))>6,"Red",DateDiff("m",CDate(Fields!ActsDate.Value),CDate(Fields!DecisionDate.Value))<=6,"Black")

  • lynns (6/9/2010)


    Try the following modification to the Switch statment (changed the arithmetic operators)

    =Switch(DateDiff("m",CDate(Fields!ActsDate.Value),CDate(Fields!DecisionDate.Value))>6,"Red",DateDiff("m",CDate(Fields!ActsDate.Value),CDate(Fields!DecisionDate.Value))<=6,"Black")

    lol 🙂 Thanks for correcting it Lynn

  • I have the dates coming in varchar format.how can use the above expression in color..

  • =Iif(DateDiff(

    "m",CDate(Fields!ActsDate.Value),CDate(Fields!ItemDate.Value)

    )>=6,"Red","Black")

    getting error in this...

    Fields!ActsDate.Value and Fields!ItemDate.value are coming varchar format

  • Are the fields ActsDate and ItemDate both varchar datatype in the original data source? If so, maybe this will work for you.

    =IIF(DateDiff("m", CAST(Fields!ActsDate.Value, datetime), CAST(Fields!ItemDate.Value, datetime))>=6,"Red","Black")

  • oops....I meant to use the CONVERT function

    Are the fields ActsDate and ItemDate both varchar datatype in the original data source? If so, maybe this will work for you.

    =IIF(DateDiff("m", CONVERT(Fields!ActsDate.Value, datetime), CONVERT(Fields!ItemDate.Value, datetime))>=6,"Red","Black")

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

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