Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 with what can i compare NULL Vs Field in SSRS

Author  Topic 

SKP
Starting Member

34 Posts

Posted - 2008-05-27 : 09:37:58
Hi Guys,

I have a report where some fields are blank, i need to put 0 when the field is blank, i tried the following
: IIf (Fields!X.Value = System.DBNull, 0, Field!X.Value)

this is complaining about System.DBNull is a type in system and cannot be used in comparison, what other types of fields can I use here to compare against Empty data?
is there anything basic I am missing?

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-05-27 : 09:38:53
use: DBNull.Value



- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

SKP
Starting Member

34 Posts

Posted - 2008-05-27 : 09:53:09
Tried that, didn't work, actually the row for which there is no value for the field gets inserted by SQL Reporting Services when grouping the data and I am not sure what to compare this with, this data is not returend by SQL stored procedure rather introduced by SSRS to cope with Grouping of data and leaves this box as Blank.
Go to Top of Page

SKP
Starting Member

34 Posts

Posted - 2008-05-27 : 10:04:28
Hey Guys,

I have solved the problem, when there is not data returend from Stored proc and SSRS inserts blank data to cope with grouping, it actually inserts default value of 0 if the field in question is int else blank string.

So i just had to change to code to compare it against 0.

Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-05-27 : 10:07:49
This is VB? If so, then try:

IsDBNull(Fields!X.Value)

or

Fields!X.Value is DBNull.Value

If neither of those work, then you don't really have NULL values, maybe empty strings ('') or nothing but spaces or something else.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -