Changing Row Colors in SSRS Report via data values?

You can write custom code. For example: Private _dateCount As Integer = 0 Function GetDateRowColor(ByVal previousDate As DateTime, ByVal currentDate As DateTime) As String If previousDate = currentDate Then ' Do nothing Else _dateCount++ End If If _dateCount Mod 2 = 0 Then Return "White" Else Return "Lavender" End If End Function Then, use expression in your Background color, for example: =Code. GetDateRowColor(Previous(Fields!

Req_Del_Dt. Value), Fields! Req_Del_Dt.

Value) HTH.

Cam - First off, BRILLIANT code! I had to stare at it for a while before I saw what you were doing. If I apply this to the BackgroundColor on a single cell, it works very well.

However, if I apply it to more than one cell (which is what happens when you apply it to a full row), it doesn't work properly. I am pretty sure that this is because it increments the counter for EACH CELL. You can see an example of the results here: imageshack.Us/photo/my-images/839/alternatingcolors2.

Jpg Can you think of a way to make this work for an entire row? THANK YOU very much for your help! – Loki70 Jul 21 at 1:44.

Got it - I should have tried harder before replying. I had to keep track of the current row number and only switch the value on new rows. Revised code: Private _dateCount As Integer = 0 Private CurRowNumber as Integer = 0 Private ColorValue as String = "" Function GetDateRowColor(ByVal previousDate As DateTime, ByVal currentDate As DateTime, MyRowNumber as Integer) As String 'Check if this is a new row number... If MyRowNumber CurRowNumber then CurRowNumber = CurRowNumber + 1 'New row, so increment counter If previousDate = currentDate Then ' Do nothing Else _dateCount = _dateCount + 1 End If If _dateCount Mod 2 = 0 Then ColorValue = "White" Else ColorValue = "Lavender" End If End If Return ColorValue 'Always return a value (for columns other than the first one) End Function Called like this: =Code.

GetDateRowColor(Previous(Fields! Req_Del_Dt. Value), Fields!

Req_Del_Dt. Value, RowNumber(Nothing)) Thank you again for your excellent response & answer!

You are welcome Loki! Glad to be of help :) – Cam L Jul 21 at 14:12.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions