I am bringing back time values from a record set into an RDLC report. (c# Visual Studio 2013)
They are coming is as a nullable Timespan.
Which i display as HH:MM
This all looks fine until i get a null , if there is no time for record a null is returned,as it's a nullable timespan type. When this happens i get an #error in the RDLC report. What i want to happen is either show "00:00" , or just blank.
I have tried adding an IFF to the Expression field in RDLC so that if a null is returned i show nothing , or "00:00" , but both return the same result , a #error in the field.
=IIF(IsNothing(Fields!Hours.Value),nothing,Format(TimeValue(Fields!Hours.Value.ToString),"hh:mm"))
Any ideas ? Thanks.
Solution update:
Thanks for all your help : This is the final expression i used to get this working in my case:
=IIF(Fields!Hours.Value.ToString = "00:00:00","",Format(TimeValue(Fields!Hours.Value.ToString),"hh:mm"))
Fields!Hours.Value.ToStringin the 3rd param ofIIF()causes an#erroranytimeHoursis null. - Conrad