Archive for March, 2007

Dealing with null values in Reporting Services

Monday, March 12th, 2007

Using conditional statements in SQL Server Reporting Services 2005 (SSRS) or SQL Reporting Services 2000 (SRS) can be a problem if the values you are working with can be null. The statement evaluator is VisualBasic based and every part of a conditional statement is evaluated, so something like:

Visual Basic:
  1. =IIF(
  2.     IsNothing(Fields!DayTimePhone.Value),
  3.     "",
  4.     IIF(
  5.         Fields!DayTimePhone.Value.Length=10,
  6.         Format(Convert.ToDouble(Code.SafeValue(Fields!DayTimePhone.Value)),"(###) ###-####"),
  7.         "etc"
  8.         )
  9.     )

will fail if the value is null. You can get around this easily by adding a bit of code:

Visual Basic:
  1. Public Function SafeValue(ByVal strValue As String) As String
  2.       Dim retValue As String
  3.       If IsNothing(strValue) Then
  4.         retValue = "0"
  5.       Else
  6.         retValue = strValue
  7.       End If
  8.       Return retValue
  9.     End Function

and modifying the conditional statement to read:

Visual Basic:
  1. =IIF(
  2.     Code.SafeValue(Fields!DayTimePhone.Value)="0",
  3.     "",
  4.     IIF(
  5.         Code.SafeValue(Fields!DayTimePhone.Value).Length=10,
  6.         Format(Convert.ToDouble(Code.SafeValue(Fields!DayTimePhone.Value)),"(###) ###-####"),
  7.         "etc"
  8.         )
  9.     )


Inside the Windows Vista Kernel: Part 2

Wednesday, March 7th, 2007

Mark Russinovich publishes the second of his articles on the internals of Vista. This one covers memory usage, SuperFetch and ReadyBoost (which I am using, but I didn't understand what was being done so I didn't really know where to look to see if it improved performance), power management (just turned this off recently because I had a Virtual PC 2007 image downloading updates), and more.

http://www.microsoft.com/technet/technetmag/issues/2007/03/VistaKernel/default.aspx