PDA

View Full Version : Embedding .prpt in a IFrame



jangalian
10-16-2014, 07:31 AM
Hi all,
as the title suggests I'm trying to embed a .prpt report in an iframe.

It turned out that I can only display the report in the iframe only when i invoke the REST API with all parameters needed, so I'm trying to get them programmatically from the report itself.

I can get the parameters list, their type and the default values; but I don't know how to get all the values a given parameter might assume, for example, as a result from a db query.

So I have the following questions:

1) is there a rest API to collect parameters of a report and their possible values?
2) is it possible to get them programmatically or I'm going to waste my time (and that of the company)

I also bought the wonderful book "Pentaho 5.0 Reporting by example" which helped me a lot, but -obvioulsy!- it doesn't cover the all the aspects of embedding.


Thank you in advance (also for the time spent reading)

Emanuele

Taqua
10-16-2014, 08:22 AM
Sure there is.

The report viewer can ask the server for all parameters and their values (as far as known) via

http://wiki.pentaho.com/display/Reporting/BI-Server+Reporting+Plugin+Documentation
(and a more general, less formal introduction is here: https://www.on-reporting.com/blog/creating-your-own-parameter-ui-for/ )

The XML format for the parameter description is explained here:
http://wiki.pentaho.com/display/Reporting/Specification+for+the+BI-Server+Plugin+Parameter-XML+format


The URLs have changed slightly in 5.0. Now the report's filename is given in the path (":home:admin:Income Statement (report).prpt" as percent-encoded UTF-8 string. The operation you want to perform is then appended at the end.

use "/parameter" to get the parameter document. Add all currently known parameter values on to it as query-parameter so that you get the correct values for all dynamic/cascading parameter.
use "/viewer" to get the report-viewer with parameter input (just in case you dont want to code your own parameter UI)
use "/report" to get the report content.

All handlers accept a set of standard parameters to control the desired output type and so on. See the first link above for details on them.

http://localhost:8080/pentaho/api/repos/%3Ahome%3Aadmin%3AIncome%20Statement%20(report).prpt/parameter

jangalian
10-16-2014, 08:50 AM
Thank you very much!!!

I wish I had stumbled on that document before!

Have a nice day

Emanuele