0

Need some help on this, as mentioned above this part trouble me cause it will show the value as #Error if the value of date is NULL. It's ok if there is a date value but not if NULL. Argghhhhhhh.... I already couple of expression below but none of it solve the issue :

=IIf(IsNothing(Fields!LastReviewDate.Value), "N/A", DateValue(Fields!LastReviewDate.Value).ToString("dd-MMMM-yyyy")) 

OR

IIf(Fields!LastReviewDate.Value Is Nothing, "N/A", DateValue(Fields!LastReviewDate.Value).ToString("dd-MMMM-yyyy")) 

OR

=IIf(Fields!LastReviewDate.IsMissing, "N/A", DateValue(Fields!LastReviewDate.Value).ToString("dd-MMMM-yyyy"))

Can anyone show me how to solve this? I wish to replace the NULL date with " " or "N/A" or " - "... This is the output :

Report show value as #Error if date is NULL

I try to change the properties on my datasource but it giving me this kind of error message :

Error when change datasource properties

leppie
  • 115,091
  • 17
  • 196
  • 297
mutanic
  • 2,448
  • 1
  • 15
  • 17

1 Answers1

0

I got the solution for my issue now, thanks to Uncle G' (Google) for giving me a lot of resources & thanks to everyone who share their knowledge over the internet! Thanks!!!

The answer is :

1) Configure your Expression for the affected column, in my case I need to check if my date type column holding a NULL value or not. This is my example :-

=Code.CheckForNull(Fields!LastReviewDate.Value)

Step 1, change the expression

2) Look at Visual Studio menu for your RDL report, select REPORT >>> REPORT PROPERTIES... Go to tab "Code" and put the function for your expression inside, this is my example :-

Public Function CheckForNull(ByVal value As Object) As String
    If IsNothing(value) Then
        Return "N/A"
    Else
        Return DateValue(value).ToString("dd-MMMM-yyyy")
   End If
End Function

Got to report properties

3) Click on OK, Save the solution & test the page where you put your ReportViewer to see the result and BRAVO you just did it right!!! Enter your function to respond to your report expression column

enter image description here

mutanic
  • 2,448
  • 1
  • 15
  • 17