Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse Process Manager (Stardust) » Getting data sets and sql from a report(How to get the sql from a report using the java api)
Getting data sets and sql from a report [message #1716965] Wed, 09 December 2015 10:30 Go to next message
Per Nyfelt is currently offline Per NyfeltFriend
Messages: 2
Registered: December 2015
Junior Member
I would like to give report users the ability to view the underlying SQL in a BIRT report but are having trouble understanding the API documentation to figure out how to do this.

Given a path to a report (reportDesignPath) and an initialized IReportEngine (called engine below) i guess I need to do get the SQL from the report design i.e.
IReportRunnable design = engine.openReportDesign(reportDesignPath);


from there i want to get all the data sets and the corresponding query text so i can display the queries driving the report but cannot for the life of me figure out how. Any hints would be highly appreciated.
Re: Getting data sets and sql from a report [message #1717253 is a reply to message #1716965] Fri, 11 December 2015 07:16 Go to previous messageGo to next message
Tanmoy Roy is currently offline Tanmoy RoyFriend
Messages: 41
Registered: September 2013
Member
Hi Nyfelt,

What is the requirement here?
If you want to capture the prepare statements generated by engine the you can dump them in logs and view the sql. is this what you are looking for?

Thanks,
Tanmoy
Re: Getting data sets and sql from a report [message #1717257 is a reply to message #1717253] Fri, 11 December 2015 07:55 Go to previous message
Per Nyfelt is currently offline Per NyfeltFriend
Messages: 2
Registered: December 2015
Junior Member
I figured it out to some extent. I have not found where these property names are documented and what the property names are for DerivedDataSetHandle, JointDataSetHandle and ScriptDataSetHandle but as all my reports are SQL query based right now the following works:

IReportRunnable design = engine.openReportDesign(reportDesignPath);
        DesignElementHandle designHandle = design.getDesignHandle();

        List<DataSetHandle> dataSets = designHandle.getModuleHandle().getAllDataSets();

        for (DataSetHandle dsHandle:dataSets) {
            String dataSetName = new ReportSql(dsHandle.getName(), "");
            String dataSourceName = dsHandle.getDataSourceName();
            DataSourceHandle ds = dsHandle.getDataSource();

            if (dsHandle instanceof OdaDataSetHandle) {
                String queryText = ((OdaDataSetHandle) dsHandle).getQueryText();
                String dataSourceDriver = (String)ds.getProperty("odaDriverClass");
                String dataSourceUrl = (String)ds.getProperty("odaURL");
                String dataSourceUser = (String)ds.getProperty("odaUser");
                String dataSourcePassword = (String)ds.getProperty("odaPassword");
            }
Previous Topic:WORK TYPE DEFINITIONS IN IPP
Next Topic:Copy Model Not Working - Attached Models For reference
Goto Forum:
  


Current Time: Mon Sep 24 23:39:29 GMT 2018

Powered by FUDForum. Page generated in 0.01920 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top