Hi,
How to get values of report’s metadata in script reports?
Cheers,
Karolina
Hi,
How to get values of report’s metadata in script reports?
Cheers,
Karolina
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
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
Hi,
yes, there are a few
I think those are the important ones.
Arno
Thanks!