Friday, March 23, 2012

Indicating the NULL value in Report Expression Syntax

Hi,

I would like to know how I can indicate a NULL value in a report expression in SSRS / Report Designer.

I am trying to code :

IIF(Value_A = 0, <NULL>, Value_A)

It may look weird but I am trying to return NULL values when Value_A is 0 (zero), in the sample scenario above.

I have tried using the keyword "NULL", but it is highlighted as a syntax error, and suggested to use System.DBNull. I tried it and then it says that components of the System collection cannot be used in an expression, so I am left drawing blanks.

Thanks.

regards,
Kenny

Use the VB keyword "Nothing"

=Iif(Fields!Value_A.Value = 0, Nothing, Fields!Value_A.Value)

|||Hi Adam,

Thanks for the tip. Worked like a charm.

Where else can I get a list of VB keywords I can use in Report Designer / SSRS / SQL Server 2005. I have some background with VB6 prior and was hoping I could port a whole bunch of them over to be used here.

Kenny
|||Most global functions were ported to VB.NET and that's what's supported in RS. For more details about RS expressions and the functions start from here http://msdn2.microsoft.com/en-us/library/ms159238.aspx

No comments:

Post a Comment