D J Horton Consulting Ltd

Personal reference to useful tips and tricks for SQL Server, SQL Server Reporting Services and Crystal Reports.



My alternative to scraps of paper lying about.



Others may find bits of it useful!








Friday, 26 February 2010

Colour graduation function - SSRS


I needed to highlight date information dependant on it's proximity to todays date. Using a colour graduation, greater emphasis is placed on dates near todays and those in the future, while less emphasis is placed on historical dates.


I created a custom function:

Public Function MonthColourGraduation(ByVal ActualValue As integer, ByVal NeutralColour As String) As String

Select ActualValue
Case >-1
Return "#FFD2D2"
Case >-2
Return "#FFD5D5"
Case >-3
Return "#FFD9D9"
Case >-6
Return "#FFDDDD"
Case >-9
Return "#FFE1E1"
Case >-12
Return "#FFE4E4"
Case >-15
Return "#FFE8E8"
Case >-18
Return "#FFECEC"
Case >-21
Return "#FFF0F0"
Case >-24
Return "#FFF3F3"
Case >-30
Return "#FFF7F7"
Case >- 36
Return "#FFFBFB"
Case Else
Return NeutralColour
End Select
End Function


and for the table rows background colour:


=Code.MonthColourGraduation((DateDiff("m", now(),Fields!LastEndTime.Value)), "White")
To get the hex colour codes I used:

Thursday, 25 February 2010

Returned from down under


Just returned from three weeks holiday in Australia, visited Adelaide, Melbourne and the bits in between. Great fun.