Hi,
is it possible to read the SQL-Query from a *.prpt-File by Pentaho-API?
Hi,
is it possible to read the SQL-Query from a *.prpt-File by Pentaho-API?
You can extract the data...
prpt can be opened as a ZIP file, and your queries are in a directory called "Datasources" as XML files. The SQL Query is in there.
**THIS IS A SIGNATURE - IT GETS POSTED ON (ALMOST) EVERY POST**
I'm no expert.
Take my comments at your own risk.
PDI user since PDI 3.1
PDI on Windows 7 & Linux
Please keep in mind (and this may not apply to this thread):
Signature Updated: 2014-06-30No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.
why work with a xml-structure if you can access the datasources directly?
MasterReport#getDataFactory()
SubReport#getDataFactory()
you most likely get a ComboundDataFactory from there (check with instanceof), which is a container containing more datafactories. Seek for the SQLReportDataFactory in there.
To get to the subreports, you most likely have to iterate over the report into the bands to get the subreports that are attached there. Will Gorman's book explains the API - otherwise have a look at the sources, our API is fairly simple.
Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.
I think, that's exactly what I would like to do, but I didn't find out yet, how I can build a MasterReport from an existing prpt-File. Is there any example for that?
I found this one: http://forums.pentaho.org/showpost.p...59&postcount=1
And tried to "copy" it.
But on Line "Resource res = manager.createDirectly(new URL(reportPath),MasterReport.class);" I get an ContentNotRecognizedException.reportPath = "file:/<pathToPrpt>";
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
Resource res = manager.createDirectly(new URL(reportPath),MasterReport.class);
MasterReport report = (MasterReport) res.getResource();
DataFactory df = report.getDataFactory();
....
What does this mean?
Ok, sorry, I solved it by myself now ;-)
Just missed some JAR-Files and forgot to boot the ReportEngine
Last edited by michael.mest; 06-30-2010 at 01:30 AM.
There are samples in the demo and the sdk (while the SDK definitely has the better documented ones). And as said: Will Gormans book goes into all the dirty details of the API - there is no better resource out there to get started.
Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.
Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.