Dates from Business Objects create error in Report Viewer

Dates from Business Objects create error in Report Viewer

Old forum URL: forums.lhotka.net/forums/t/3532.aspx


Lyndon posted on Thursday, September 13, 2007

Hi,

I have connected up my business objects  successfully to some reports constructed in the ReportViewer.

But when the ReportViewer renders the report- the date columns all come up as errors. It appears that the Reportviewer doesnt recognize them as dates ( ie mebbe because they are smartdates?)

Anyone else seen this behaviour and have ideas how to correct ?

RockfordLhotka replied on Thursday, September 13, 2007

Are you exposing your properties as type SmartDate?

That is not recommended, and is not the purpose of SmartDate. SmartDate should be used inside your object to expose a "date" property as a string.

Lyndon replied on Thursday, September 13, 2007

That might be it.

In a class called ServiceRequestInfo, I have  a date property defined as follows:

Public Property DateSubmitted() as SmartDate

Get

Return mDateSubmitted

End Get

Then I have another class called ServiceRequests which inherits this ServiceRequestInfo as ReadonlyListBase per your code examples.

The DataPortal_Fetch in the ServiceRequests Class has the dr.GetSmartDate(1)

 

 I am assuming from your comments above that I should be exposing the above property as a string instead  and then the DataPortal_Fetch as dr.Getstring(1)?

Its weird because the datagrid rendering of the data using ServiceRequests seem to be fine, but the reportviewer didnt seem to be.

Thank you for your response!

JoeFallon1 replied on Friday, September 14, 2007

Not quite.

In Fetch you still retrieve SmartDate and populate mDateSubmitted which is of type SmartDate.

You change your Public Property to:

Public Overridable Property DateSubmitted() As String
 
Get
   
Return mDateSubmitted .Text
 
End Get

  Set(ByVal Value As String)
   
If mDateSubmitted .Text <> Value Then
     
mDateSubmitted .Text = Value
      PropertyHasChanged(
"DateSubmitted")
   
End If
 
End Set
End Property

 

Lyndon replied on Friday, September 14, 2007

That was it- now its working perfectly.  Dates working properly in both grids and reportviewer reports.

Way cool!

Thanks Rocky and  Joe!

Copyright (c) Marimer LLC