views:

17

answers:

1

Below is my SQL query used in SSRS report

SELECT Claimname,CONVERT(VARCHAR,ClaimResponsedate,101) FROM Claim WHERE DataSourceID = 100011

From the above query 'ClaimResponsedate' may get NULL values but in SSRS report for this field displaying 1/1/1990 when the value comes as NULL.

I need to display empty value in report if the date value is NULL.

I tried below code to avoid but it is not working =IIF(IsNothing(Fields!ClaimResponsedate.Value),"",Fields!ClaimResponsedate.Value) OR =IIF(Len(Fields!ClaimResponsedate)=0,"",Fields!ClaimResponsedate.value)

So please help me to achieve this i.e. display empty value in report if the date value is NULL

Thanks in advance

A: 

Change your SQL to be:

SELECT Claimname,
    CASE WHEN ClaimResponseDate IS NULL THEN NULL ELSE 
    CONVERT(VARCHAR,ClaimResponsedate,101) END as [ClaimResponseDate]
 FROM Claim WHERE DataSourceID = 100011

The other option is to change your report field to be the following:

=Replace(Fields!ClaimResponsedate.Value,"1/1/1900","")
ck
Yes i tried this scenario also even though in the report it is displaying 1/1/1900..So please advice me to achieve
VinnaKanna
@VinnaKanna: Update with alternative solution
ck
Would "WHEN ClaimResponseDate IS NULL THEN ''" not be a better choice for your first solution?
Frank
@Frank - yeah I guess that would be better.
ck
But if really the claim has 1/1/1990 then we will loose the data correct?Is there any another approach to solve this
VinnaKanna

related questions