Monday, March 12, 2012

Get the Report Model Fields of a particular report?

If I have a Report Path and I want to get at the fields associated with this report's Model (not the fields in the Report!!!), is there a way to do so using the ReportingService2005 or the VS.NET 2005 ReportViewer control?

I have played around with the ReportingService2005.GetItemDataSources() and the ServerReport.GetDataSources() (ReportViewer) methods, but with no luck.

I imagine that this functionality must be available becuase the Model fields are displayed in the Report Builder application once you select a Model.

Thanks!

Brian McCullough

OK...to get back to the Model do this:



New" size="2">Dim datasources() As DataSource = rs.GetItemDataSources(rptViewer.ServerReport.ReportPath)

For Each ds As DataSource In datasources
Dim modelPath As String = DirectCast(ds.Item, DataSourceReference).Reference

Dim modelItems() As ModelItem = rs.ListModelItemChildren(modelPath, Nothing, True)
For Each modelitem As ModelItem In modelItems
If item.Type = ModelItemTypeEnum.Attribute Then
'this is a field in the Model
'now how do i get the FieldType?
End If
Next

Next

Now how do I get the Field Type (i.e. String, Date, etc...)?

-Brian

No comments:

Post a Comment