Tuesday, November 10, 2009

Displaying data source information in Reporting Services reports using expressions

The following expression is about the best I have come up with:

=DataSources("myDataSource").DataSourceReference & " " & DataSources("myDataSource").Type

This will display:


  • Data source name - probably also "myDataSource" in this example. The full path is provided when the report is run in Report Manager
  • Data source type e.g. "OLEDB-MD" is an Analysis Services data source

Limitations:

  • You can't use expressions referring to data sources in the header or footer. But who wants the data source details displayed in the report body??
  • The data source reference has to be hard coded in every report. I'm not aware of any way to enumerate this to just fetch the first datasource. It would be fantastic if the following worked, but it doesn't:
=DataSources[0].DataSourceReference & " " & DataSources[0].Type

No comments: