- Microsoft SQL Server Reporting Services 2012
- Microsoft Visual Studio 2012 Premium
- Microsoft Windows 7 Enterprise
What?
So I have a column in an SSRS report which displays a date. Being rather pernickety, I would like a question mark to display if there is no date to populate the field.
Why?
At the moment, the expression in there is something like this:
=Format(Fields!MyCompletionTime.Value, "dd/MM/yyyy HH:mm:ss") -- yields 11/02/2014 11:21:32Sounds good, where's the problem?
The problem
Putting the date in an IIF (if-then-else) statement displays "#Error". You should get errors referring to converting strings to dates and incorrect data types.
How?
The fix is to simply get the field and both results to be of the same data type:
=IIF(CStr(Fields!MyCompletionTime.Value)<>"", Cstr(Fields!MyCompletionTime.Value), "?")
Discussion
Comments
Questions, corrections and useful additions are reviewed before appearing here.
No comments yet. Start the discussion.