Skip to main content



      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 05:30 Go to next message
Eclipse UserFriend
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 02:16 Go to previous messageGo to next message
Eclipse UserFriend
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 02:55 Go to previous message
Eclipse UserFriend
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: Sun Jun 15 08:54:02 EDT 2025

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

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

Back to the top