Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring & Generating BIRT Reports Dynamically

From watching the 2-part YouTube videos and perusing the BIRT manual, my understanding of it is the the worflow goes something like this:

  • Create a new Report in Eclipse
  • Use the BIRT Report Designer (Eclipse plug-in) to design a report
  • Populate the report with Data Sources (JDBC drivers & databases) and Data Sets (specific tables)
  • Generate/export/print the report

As cool as this tool seems to be, I cannot find any documentation that leads me to believe that this is a Java tool and not an Eclipse-only tool (meaning, it has a Java API and can interact with Java apps, as opposed to a pure Eclipe plug-in which requires manual/human interaction from the Eclipse IDE.

Specifically, I want to confirm that BIRT either can or cannot do the following:

  • Configure a report (layout, UI widget placement, data sources/sets, etc.) programmatically; i.e. in the same way that JasperReport API has the iReport designer that generates JRXML, is the same true for BIRT?
  • Kick off a report "generation" through a Java API whereby data gets read-in realtime and populates the report and the report can be sent out or stored on a file system
  • Create HTML and PDF versions of the same report
like image 651
IAmYourFaja Avatar asked Jul 07 '12 02:07

IAmYourFaja


People also ask

What do you mean by configuring?

to arrange or organize. computing to set up (a piece of hardware or software) as required.

What's another word for configure?

In this page you can discover 23 synonyms, antonyms, idiomatic expressions, and related words for configure, like: setup, build, customize, structure, form, compose, pattern, make, router, shape and install.

What is configuration in vocabulary?

an arrangement of parts or elements.

Is configure a word?

verb (used with object), con·fig·u·rat·ed, con·fig·u·rat·ing. to give a configuration, form, or design to.


2 Answers

Answers to your questions:

  1. Yes. BIRT may not be as powerful as JasperReports, but it can achieve most of the common needs. BIRT designer generates a .rptdesign file similar to JRXML in JasperReports.

    About your question: almost everything is possible to achieve programmatically in BIRT. BIRT Report Engine APIs is the best source for you to get started with all the functionalities you have mentioned. It has good examples given for every functionality.

  2. Not sure. BIRT usually fetches pre-saved data from DB and generates the report. You could though see the real time data representation (in the form of a flash chart may be) with the help of some external libraries (See if this thread and this example helps). But I am not aware of a direct way of converting the real time data to PDF/HTML report. You will have to find some hack(s).

  3. Yes of course. Refer the APIs. To be specific, irendertask.

Sources to get more information/answers:

  1. There are several example reports given on the website. A quick glance through them might give you more insights.

  2. For discussions and troubleshooting, refer eclipse community forum and BIRTExchange (heavily used by BIRT users).

  3. BIRT: A Field Guide to Reporting is an excellent book. I've used it myself from time to time.

like image 68
Pale Blue Dot Avatar answered Oct 06 '22 16:10

Pale Blue Dot


I can confirm that the two BIRT components you are interested in using (BIRT Design Engine and Report Engine) will work in a pure-Java context and are deployable without Eclipse. I have deployed BIRT reports to run out of standalone Tomcat servers as well as Pentaho BI Server, and have exercised report definitions at the command line using shell scripts (no Eclipse involved).

Answers to your questions:

  1. Configure a report programmatically: use the Design Engine API. I am not familiar with the Jasper Reports API so cannot comment on whether the BIRT method is similar, but the example code provides a good illustration. In particular, note lines 120-133 which add and manipulate widgets in the report, and how line 136 calls saveAs to save the report design file.

  2. Generate a report in realtime: use the Report Engine. The sample code for the IRunAndRenderTask may be the most useful for you at first, but the engine has the ability to separate the data processing (extract and aggregate) of the report from the rendering and paging. I believe the examples focus on running reports from a Servlet, but it is easy to extract that logic from the servlet container logic.

  3. Create both HTML and PDF versions: easily handled in the Report Engine via the IRenderTask. Once you've been through all the other setup work, changing the output format to produce PDF vs HTML is something of a joy. In my experience, it just works.

I found it useful to start out with a very simple Java class (adapted from the very old code here) to run a test report, called from the command line.

like image 34
khoxsey Avatar answered Oct 06 '22 15:10

khoxsey