#1 2015-01-29 16:45:14

karolina
Member
Registered: 2014-08-09

metadata values in script reports

Hi,

How to get values of report's  metadata in script reports?

Cheers,
Karolina

Offline

#2 2015-01-29 17:19:35

Arno Mittelbach
datenwerke
Registered: 2012-02-14

Re: metadata values in script reports

Hi Karolina,

in a script report you get access to the report object via the variable

report

As the metadata is not stored on the report variant (which is automatically created behind scenes, even if you execute a base report)
you need to access the parent to get to the metadata. That is

report.getParent()

To get a specific metadata field you can then use the method getReportMetadataByName("key").

The following is an example that just outputs all available metadata

return "<ul>" + report.getParent().getReportMetadata().collect { 
  "<li>" + it.getName() + ": " + it.getValue() + "</li>"
}.join() + "</ul>";

getReportMetadata returns a collection of net.datenwerke.rs.core.service.reportmanager.entities.reports.ReportMetadata objects.

Cheers
Arno

Offline

#3 2015-01-29 17:30:13

karolina
Member
Registered: 2014-08-09

Re: metadata values in script reports

Hi Arno,

Thanks a lot for this explanation.

Are there other variables like that (i.e. that its not necessary to declare them) that are available in script reports?

Karolina

Offline

#4 2015-01-29 17:35:02

Arno Mittelbach
datenwerke
Registered: 2012-02-14

Re: metadata values in script reports

Hi,

yes, there are a few

  • outputFormat: The requested output format

  • parameterSet: The parameters (this is an object containing all the parameters as they are represented within ReportServer)

  • parameterMap: A map of the parameters. More convenient to use. Key should point to the actual parameter

  • connection: the database connection if one is configured

  • report: the report object

  • user: the current user

I think those are the important ones.

Arno

Offline

#5 2015-01-29 17:38:46

karolina
Member
Registered: 2014-08-09

Re: metadata values in script reports

Thanks!

Offline

Board footer

Powered by FluxBB