bmsqldev
bmsqldev

Reputation: 2735

Handling NULL Dates in SSRS

We have a SSRS Report. This report have a field called Actual Date. Whenever this field is null, the report need to show "N/A". To handle this, I have done as below.

="Report End Date: "= IIF(IsNothing(CSTR(First(Fields!Actual_Max_Date.Value, "dataset1"))), "N/A", CSTR(First(Fields!Actual_Max_Date.Value, "dataset1")))

But I always get False as Result. anything wrong in the above expression? Also is it possible to add custom color to the string "N/A"?

Thanks for the help

Upvotes: 1

Views: 2758

Answers (1)

Marco Bong
Marco Bong

Reputation: 690

Use String.IsNullOrEmpty() instead of IsNothing()

and

1st part of your expression (="Report End Date: "=IIF....)

should be ="Report End Date: " + (IIF....))

Example (My report parameter is datetime picker):

="Report End Date: " + (IIF(String.IsNullOrEmpty(Parameters!ReportParameter1.Value),"N/A",Parameters!ReportParameter1.Value))

Upvotes: 2

Related Questions