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.

Thursday, 20 August 2009

Conditional formatting - using a function - SSRS

Another option is to write a function to do this and an example below involves a case statement. In the color property of the textbox, you can reference the function like so:


If you had multiple textboxes on a report that required the same colour formatting, this technique would be a bit more reusable.

Public Function GetColour(ByVal InputValue As Double) As String
Case InputValue
Case 1000
GetColour = "Red"
Case 10000
GetColour = "Blue"
Case 30000
GetColour = "Green"
Case Else
GetColour = "Black"


No comments: