MrBool
You must be logged in to give feedback. Click here to login
[Close]

You must be logged to download.

Click here to login

[Close]

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

[Close]

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

Integration of BIRT Report with Java EE

In this article we will discuss about BIRT report and its integration with Java EE. We will see also how to develop a BIRT report.

[close]

You didn't like the quality of this content?

Would you like to comment what you didn't like?

BIRT is an open source-reporting tool. It is very user friendly and quite lightweight reporting tool. BIRT provides some core reporting feature such as report layout, data access and scripting, chats, bar, some others facilities as well. We can try BIRT to building report easily. We can use the Business Intelligence and Reporting Tools like BIRT report development tool to develop a range of reports. BIRT provides all kinds of facilities to build and preview report. After ringing the birt report on report viewer, we can download it in any format like Microsoft word, Microsoft Excel, Pdf and HTML.

Now we will show how to develop a BIRT report. The name of the report is “division.rptdesign”. The extension of BIRT is ‘. Rptdesign’. We start with a blank report design.

Before you start designing your report in the layout editor, you build a BIRT data source to connect your report to a database or other types of data sources. When you build a data source, you specify the driver class, data source name and other connection information, such as user name and password. For this article, you use the sample database as as oracle or Mysql to design a simple report. BIRT Report Designer provides an easy sheet that contains systematic instructions, to help. You can create the report.

Now, you start with a blank report design.

Choose File->New->Report. New Report appears. There you write the name of the report.

To establish the connection you Right-click Data Sources, then choose New Data Source from the context menu. New Data Source displays the types of data sources you can create now select Classic Models Inc. Sample Database from the list of data source types. Use the default data source name, and then choose next. Connection information about the new data source appears. By this way, you can create a database connection with Birt Report.

Build Data Source

Figure 1: Build Data Source.

In the text area, type the following SQL SELECT statement to specify the data to retrieve:

Listing 1: Data retrieval

Select divisionName,
DivisionNameBen,
ContactFirstName,
Phone
From ConfDivision
Or 
Select *
From ConfDivision

Although the dataset editor shows table and column names in capital letters, you can type the names how you prefer, because SQL is not case-sensitive. If you do not want to type the query, you can drag columns and tables from the Available Items to the text area.

Before you start designing your report in the layout editor, you build a BIRT report data source to connect your report to a database or some other types of data sources. At the time, when you build a data source, you specify the driver class, data source name, and other connection information, such as user name and password. Of these articles, you use the sample database, Classic Models that is already configured for use with BIRT Report Designer. You do not need to specify the connection. At first need to make a data source. Depending on our requirement, we will develop a SQL query. Here we will provide the screen shot of it. As per your requirement, you generate the data source. Most of the time, ‘Jsp’ pages use pass any parameter. You can add any filter as per your requirement; this helps you to retrieve some data which want to show. Parameters and filters are important to design a report.

When you go to preview the Birt report, you can incorporate chart and other things with on it, to make this very interactive. We can use and filter or add some parameter depending on our requirement.

BIRT report designing is easy and less time consuming. We add features like table, grid, and text area and text field by drag and drop. The BIRT development environment generally includes a report designer, a charting engine, and a run time environment and much more fixtures. The BIRT is a reporting tool that mainly focuses on Eclipse. But we can connect it with other suit like net beans. We easily can use BIRT to create tables, chart, list, and cross tab reports to display data sets. It is very easy to incorporate JavaScript and any condition what we like. We can also develop reports that are more complex and elaborate by using scripts.

The layout of BIRT report

Birt Report  Layout

Figure 2: Birt Report Layout

When the query is finished then choose Finish to save the data set. Edit Data Set displays the columns you specified in the query, and provides options for editing the data set. Then, choose Preview Results to make sure the query is valid and that it returns the correct data. If you typed the SELECT statement correctly, you should see the results that are shown in the preview. This helps you to design the Birt report.

In the layout editor, you can design as per your requirement. The table cell in which you dropped the confDivision field contains a data element that displays [divisinName]. Above this data element is a label element that the layout editor automatically added to the header row. This label displays the field name as static text. It serves as the column heading. In this way you can design the Birt Report.

We can run BIRT reports by using the BIRT report viewer or Maximo Reports viewer or by using the Report List box in the Maximo Assistance Management Start Center. That is one of the ways to run a BIRT report. The mention figures imply the BIRT development environment components and the interfaces between them. We here want to view the steps.

If we want to build BIRT report, we need to add the BIRT plug-in with our eclipse. The BIRT community provides eclipse, which have built facilities of BIRT. BIRT jars and ‘tiled’ files can work with J2EE structure. Now we will show how to create a Simple BIRT report. We will provide step by step process.

This xml code creates by the time of Birt report design. The Birt generates a huge amount of xml code by the time of design. You can add some your customize design on it by editing it. There the xml code previews some sql code that we mentioned in data source. This is very important also to edit the xml when requires.

Now we show the xml file of “Division. Rptdesign”.

Listing 2: Full code for xml file of “Division.rptdesign”.

<? Xml version="1.0" encoding="UTF-8"? >
<Report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20" id="1">
    <Property name="createdBy">Eclipse BIRT Designer Version 2.5.1. v20090903 Build < 2.5.1. v20090917-1447></property>
    <property name="units">in</property>
    <property name="iconFile">/templates/blank_report.gif</property>
    <property name="layoutPreference">auto layout</property>
    <property name="bidiLayoutOrientation">ltr</property>
    <data-sources>
        <oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="ssnp" id="834">
            <list-property name="privateDriverProperties">
                <ex-property>
                    <name>contentBidiFormatStr</name>
                    <value>ILYNN</value>
                </ex-property>
                <ex-property>
                    <name>metadataBidiFormatStr</name>
                    <value>ILYNN</value>
                </ex-property>
            </list-property>
            <property name="odaDriverClass">com.mysql.jdbc.Driver</property>
            <property name="odaURL">jdbc:mysql://192.168.0.3:3306/ssnp</property>
            <property name="odaUser">root</property>
            <encrypted-property name="odaPassword" encryptionID="base64">cA==</encrypted-property>
            <property name="odaJndiName">java:ssnpDatasource</property>
        </oda-data-source>
    </data-sources>
    <data-sets>
        <oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet" name="division" id="835">
            <list-property name="columnHints">
                <structure>
                    <property name="columnName">Division_ID</property>
                    <text-property name="displayName">Division_ID</text-property>
                </structure>
                <structure>
                    <property name="columnName">Division_Name</property>
                    <text-property name="displayName">Division_Name</text-property>
                </structure>
                <structure>
                    <property name="columnName">Division_Name_Ben</property>
                    <text-property name="displayName">Division_Name_Ben</text-property>
                </structure>
                <structure>
                    <property name="position">7</property>
                    <property name="name">Type</property>
                    <property name="nativeName">Type</property>
                    <property name="dataType">integer</property>
                    <property name="nativeDataType">4</property>
                </structure>
            </list-property>
            <xml-property name="queryText"><![CDATA[SELECT * from conf_division]]></xml-property>
            <xml-property name="designerValues"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<model:DesignValues xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design" xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
  <Version>1.0</Version>
  <design:ResultSets derivedMetaData="true">
    <design:resultSetDefinitions>
      <design:resultSetColumns>
        <design:resultColumnDefinitions>
          <design:attributes>
            <design:name>Name</design:name>
            <design:position>1</design:position>
            <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
        <design:resultColumnDefinitions>
          <design:attributes>
            <design:name>Upazila_Name_Ben</design:name>
            <design:position>4</design:position>
            <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
            <design:precision>250</design:precision>
            <design:scale>0</design:scale>
            <design:nullability>NotNullable</design:nullability>
            <design:uiHints>
              <design:displayName>Upazila_Name_Ben</design:displayName>
            </design:uiHints>
          </design:attributes>
          <design:usageHints>
            <design:label>Upazila_Name_Ben</design:label>
            <design:formattingHints>
              <design:displaySize>250</design:displaySize>
            </design:formattingHints>
          </design:usageHints>
        </design:resultColumnDefinitions>
        <design:usageHints>
            <design:label>Project_Type</design:label>
            <design:formattingHints>
              <design:displaySize>10</design:displaySize>
            </design:formattingHints>
          </design:usageHints>
        </design:resultColumnDefinitions>
        <design:resultColumnDefinitions>
          <design:attributes>
            <design:name>Amount_Distributed</design:name>
            <design:position>29</design:position>
            <design:nativeDataTypeCode>3</design:nativeDataTypeCode>
            <design:precision>10</design:precision>
            <design:scale>2</design:scale>
            <design:nullability>Nullable</design:nullability>
            <design:uiHints>
              <design:displayName>Amount_Distributed</design:displayName>
            </design:uiHints>
          </design:attributes>
          <design:usageHints>
            <design:label>Amount_Distributed</design:label>
            <design:formattingHints>
              <design:displaySize>12</design:displaySize>
            </design:formattingHints>
          </design:usageHints>
        </design:resultColumnDefinitions>
</model:DesignValues>]]></xml-property>
        </oda-data-set>
    </data-sets>
    <styles>
        <style name="crosstab" id="4">
            <property name="borderBottomColor">#CCCCCC</property>
        </style>
        <style name="crosstab-cell" id="5">
            <property name="borderTopWidth">1pt</property>
        </style>
    </styles>
    <page-setup>
        <simple-master-page name="Simple MasterPage" id="2">
            <property name="type">a4</property>
            <page-footer>
                <text id="3">
                    <property name="contentType">html</property>
                    <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
                </text>
            </page-footer>
        </simple-master-page>
    </page-setup>
    <body>
        <label id="1428">
            <text-property name="text">                                                                                          </text-property>
        </label>
        <table id="1788">
            <property name="dataSet">division</property>
            <list-property name="boundDataColumns">
                <structure>
                    <property name="name">Division_Name</property>
                    <text-property name="displayName">Division_Name</text-property>
                    <expression name="expression">dataSetRow["Division_Name"]</expression>
                    <property name="dataType">string</property>
                </structure>
                <structure>
                    <property name="name">Type</property>
                    <text-property name="displayName">Type</text-property>
                    <expression name="expression">dataSetRow["Type"]</expression>
                    <property name="dataType">integer</property>
                </structure>
            </list-property>
            <header>
                <row id="1789">
                    <cell id="1792">
                        <label id="1793">
                            <text-property name="text">Division_Name</text-property>
                        </label>
                    </cell>
                    <cell id="1794">
                        <label id="1795">
                            <text-property name="text">Division_Name_Ben</text-property>
                        </label>
                    </cell>
                    <cell id="1796">
                        <label id="1797">
                            <text-property name="text">GO_Code</text-property>
                        </label>
                    </cell>
                    <cell id="1798">
                        <label id="1799">
                            <text-property name="text">Description</text-property>
                        </label>
                    </cell>
                    <cell id="1800">
                        <label id="1801">
                            <text-property name="text">Status</text-property>
                        </label>
                    </cell>
                    <cell id="1802">
                        <label id="1803">
                            <text-property name="text">Type</text-property>
                        </label>
                    </cell>
                </row>
            </header>
  <footer>
                <row id="1819">
                </row>
            </footer></table></body>
</report>

As per our requirement, we can modify the report by different style. Here we present the preview page of BIRT report. We know the BIRT view preview the report.

Birt Report View

Figure 3: Birt Report View

This is the way how to build and preview any birt report. You just built your first report and worked with some of the basic tools and features of the BIRT Report Designer. There are many more tasks that you can accomplish to build more sophisticated reports.

It is very easy to add any king of style and script on this report. It works quite easily with J2ee framework.

This is all for today’s article. Hope you like article.



My main area of specialization is Java and J2EE. I have worked on many international projects like Recorders,Websites,Crawlers etc.Also i am an Oracle Certified java professional as well as DB2 certified

What did you think of this post?
Services
Know how to keep MrBool Online
SUPPORT US
SUPPORT US
With your help, we can keep providing free content and helping you to be a better professional
support us
[Close]
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually � in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits � in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits
[Close]
You must be logged to download.

Click here to login