Create A Custom Table Report using Helical Insight (Dynamically Picking the Columns Names and Data)

Create A Custom Table Report using HI (Dynamically Picking the Columns Names and Data)

If you have already had a Hands-On experience on the Helical Insight Tool [HI tool] then this blog would be helpful

For a creating a report there are 4 files required
1. EFW

the Report Layout lies on the HTML page, the SQL queries lies within the EFWD file and the visualization lies in the EFWVF File.
Hence once the Query is fired it comes to the visualization file to create a table as that’s our goal. With the help of the following code below it can be created with ease.

The below code here is a template of our EFWVF looks like
<Chart id=”1″>

//Your Visualization Code Goes Here


Chart ID here is 1 which is unique
Type is of custom
DataSource 1 is the Unique ID defined in the EFWVF File. ie (<DataMap id=”1″ )
Now within the <script> </script>
we Paste the following:

//The If Block Does Return A Message NO Data when there is No Data
if(data.length == 0)
$(‘#chart_1′).html(“<div ><h4 style=’text-align:CENTER;color:black; padding-top:60px;’>No Data Available For Current Selection</h4></div>”);
//The Else Block Returns The Table if there is a Table
//Here the funtion Tabluate Returns the Data in Tabular Form
function tabulate(elem, data, columns)
//Function Start
var table =“table”)
.attr(“class”,” table display compact width:100%;cellspacing:1 “)
thead = table.append(“thead”),
tbody = table.append(“tbody”);

//Append the header row
.text(function(column) { return column; })
.attr(‘class’, function(d, i){ return “colH_” + i; })
.style(‘@media print’,’display:none’)

// create a row for each object in the data
var rows = tbody.selectAll(“tr”)

// create a cell in each row for each column
var cells = rows.selectAll(“td”)
.data(function(row) {
return {
return {column: column, value: row[column]};
.text(function(d) { return d.value; })
.attr(‘class’, function(d, i){ return “col_” + i; })
.attr(‘align’, ‘left’)
return table;
//Function END

//Render the table
//Object.keys(data[0]) is the Data to fetch the Column Header
//data has the data of the Table
var subjectTable = tabulate( ‘#chart_1’, data, Object.keys(data[0]));
Save it in the same Directory with rest of the file

Run your report on HI and you get a table.

Keep in mind you can change the query and still get the new columns from the new query.

Sohail Izebhijie

The Print When Expression

The Print When Expression

The print when expression in Jasper Studio or Jasper iReport is very useful in so many requirements and it is defined as the name itself implies
i.e Print /Show a String, Column and so on Based on a condition passed.
Now here are some requirements on how/when we can implement The Print when expression.

Requiremnt: Show a particular column when a parameter is selected
Here we made a parameter Called ShowLocation with values either ‘Y’ or ‘N’/blank space
now when ‘Y’ is selected then a Location column should show and when ‘N/blank space then it doesn’t show.

2 ways i did approach this:

1. I made a 2 Table Components one with the Location Column added and the other without the Location Column added.
one on top the other.
so when my parameter calls a ‘Y’ value it picks the Table with the Location Column and vice versa.

This approach is good but can be time and performance consuming

the 2nd approach was:

2. Only one Table Component was used, Opened the Table Component and selected the Column i want to restrict/show based on the parameter passed, in my scenario or requirement it is the Location column as
shown in the image below:


now i would select the cell button

Cellin the properties Tab and then Select the
Print When Expression.

Now here in the print when expression box i would write :
$P{showlocation}.equals(“Y”) as shown above


and you are good to go for a preview.
Now Let’s have to put a N or blank space in the parameter showlocation we get the following output
and now let’s pass ‘Y’ in the showlocation parameter

So Now with this condition it will show the column when the parameter is checked in with a ‘Y’ Value.
and voila the output:


Sohail Izebhijie.

Creating a simple BIRT report

Creating a simple BIRT report

This is a small tutorial to help you get started with BIRT report development. We will setup the BIRT report designer and create a simple tabular BIRT report accessing data from a MySQL database.

Below are the steps –

Getting the BIRT report designer
You can download the BIRT report designer at .

It provides various download options. I went with the “All-in-One” download package which included eclipse with all the necessary BIRT plugins preinstalled. You just need to unzip the archive file and then start the eclipse application.

Adding required drivers for DB connection
If you want to add any drivers for your database connections to be used in the designer, copy the driver jars to the below folder in your eclipse installation before you start eclipse –

<eclipse home>\plugins\\drivers

In this case, I added the mysql driver jar file.

Creating a project
Once you have the report designer all set up, create a new project in eclipse with the “new project wizard”. You can see a new Projects Category appearing in the wizard selection list – “Business Intelligence and reporting tools”, select “Report Project” option under it.

Fig 1 new  report project

Adding BIRT report to the project
Now add a new report file (rptdesign) to the project. Right click on the project in the navigator window and click new à report, give an appropriate name to the file which will contain the report definition of the BIRT report. It’s a XML based report design – a single “.rptdesign” file which contains everything that is required for the report to execute.

Fig 2 New report file

Designing the report
When the “rptdesign” file is open, in the main window, it shows 4 tabs. It shows a canvas in the first tab, the visual layout view of the report – where you can drag and drop various items from the palette to design the report. The other tabs are the master page, scripts tab for you to add any custom scripts, the XML source tab to view the source of the design file as it gets generated.

In the “Outline” window, you can see the entire list of things that will define your report. We will now use this window to start adding components to our report.

1. Creating a data source

Right click on the “Data Sources” in the Outline window and select “new Data Source” to open the wizard. It lists all the different types of data sources that can be created. For this tutorial, we select JDBC Data source and then fill in the required connection details to create the data source –
Fig 3 Data source proerties

2. Creating a Data Set

A dataset is basically the query that would fetch the data to be displayed in your report. You can associate a dataset with your tables, charts and any other report elements.

Right Click on the “Data Sets” in the outline, to define your dataset. The wizard allows you to first select one of the datasets and then select the “Data Set Type” which in our case would be a SQL query. Write your SQL query text, which in our case is a simple select statement –

Fig 4 Query for Dataset

Once finished, all the fields start showing up under the dataset in the outline

3. Adding a table to the report

Now drag a “table” component from the palette and drop it on the canvas. When you do, it asks for a dataset to associate with the table. Select the one we created in the step above. It will display all the fields from the dataset from which you select the ones to be displayed in the table. When you click finish, you see a table on the canvas, with 3 sections – Header, Detail and Footer.

The detail section columns will be automatically bound with the various fields we selected and header labels will also be set.

Fig 7 Table

You may use the “properties window” to format the table look and feel. I have added some borders and changed the font etc.

Fig 6 Properties Window

We are more or less done with a basic report. I also have changed the page heading for the report, by navigating to the “Master Page” tab and changing the same there.

Fig 8 Master Page

Previewing the report

There are various types of preview available –

Fig 9 Birt Report Previews

When you preview in web viewer, the BIRT report viewer is used to render the report.

Fig 10

With this, our simple BIRT report is done!! More posts on BIRT reporting to follow, stay tuned !

Shraddha Tambe | Helical IT Solutions

You may also like to read –
Introduction to BIRT (Business Intelligence and Reporting Tools)

Introduction to BIRT (Business Intelligence and Reporting Tools)

Introduction to BIRT (Business Intelligence and Reporting Tools)

BIRT is an Open source data visualization and reporting platform first released in the year 2004. It allows to pull data from a variety of data sources like SQL Databases, Web Services, XML, JDO Datastores, POJOs etc, structure the data, summarize, calculate and visualize the same. These reports or data visualizations can be very easily embedded into web applications or rich client applications, especially those based JAVA/Java EE.

BIRT Components

BIRT has 2 main components

1. BIRT report designer & the Design Engine

This comes as a set of plugins for Eclipse or also as a Rich Client Platform. This allows designing reports which are stored as XML files. The Design Engine is the actual core that is used for creating and modifying the reports. It provides the functionality via a Design Engine API. The BIRT report desinger uses this API to auto generate/construct the XML design files.

2. BIRT runtime / Report Engine

This component uses the Report Design File to generate reports by fetching data from the datasources mapped in the report and render the same in various formats like HTML, PDF, CSV, XLS etc. It exposes this functionality via its Report Engine API. Using this API, it can be embedded in any Java application.

Other components are

1. BIRT charting engine

This is used to design, generate charts in the reports. This is used in the design/report engines to provide the data visualization capabilities.

2. BIRT viewer

The Web Viewer can be used to generate and render reports, and also supports more interactive features such as table of contents, exporting report content to several formats, client and server side printing, as well as report pagination. It uses the BIRT runtime for the same.

BIRT Report Design

BIRT design engine constructs XML based report design – a single “.rptdesign” file which contains everything that is required for the report to execute. BIRT is based on a comprehensive report object model (ROM) that describes all aspects of the report. BIRT’s suite of report-specific XML elements and properties is called Report Object Model (ROM).

A BIRT design is structured as hierarchy of report elements. The term element simply means an object that appears as part of the report. The elements may be visual elements like text boxes, tables, lists, charts, cross tabs etc or non-visual elements like datasources, scripts, data sets etc.

Accessing Data in BIRT

In order to access data in BIRT reports, you need to typically work with the below :

1. Data sources– Typical data sources are relational Databases, XML files, POJOs etc. Data source elements hold all the connection details that are required to fetch data from the source. A BIRT report may have more than one Data sources.

2. Data sets – Typical datasets are SQL queries, stored procedures etc., which define what data is to be pulled into the report. A report may have multiple data sets, at least one dataset for every data source or even multiple datasets on a single data source. BIRT also allows us to join 2 datasets to create a “joint dataset”. This can be very useful to join data from disparate data sources or from non-relational data sources like xml files etc.

3. Data cubes – These are specifically introduced to support dynamic crosstabs. It allows you to specify the row fields and hierarchy,the column fields and hierarchy and also the measures to be shown in the body of the crosstab. It does not require the query data to already be in a multi-dimensional structure, the cube transforms the flattened data into hierarchical, analysis ready data.

4. Column bindings – The data from the datasets/data cubes can be displayed/used in various report elements like tables, charts, text boxes by creating “column bindings”. The Column bindings are an intermediate layer between the report elements
and the dataset fields. Typically a “column binding” is an expression which uses the dataset fields to formulate the data to be displayed to the end user in a report element. These are also useful to give descriptive names to the dataset fields, accessing data from functions or user defined calculations, it makes creation/updation of calculated fields quite easy.

Report Structure / Layout

A report document is typically structured as a series of sections like Report Title, multiple Detailed sections which may also contain groups (group headers, footers), summary sections. These sections may contain single or multiple report elements.

BIRT report elements broadly fall in 2 categories:

1. Elements that display/visualize data like Label, Text, Dynamic text, image, chart, crosstab etc
2. Elements that help organize other elements in to the section (Containers) like Grid, Table, Lists etc

A Grid is row/column format container, used to organize static elements like text, pictures into sections, similar to a HTML Table.

A Table on the other hand is used to display dynamic data in row and column format. Table has 3 types of rows, header, footer and detail row. It can be bound to a single dataset only.

A List is used to display dynamic data in any other format than rows and columns. It also contains header, footer and detail areas.

Content Formatting / Styling

BIRT provides a lot of formatting properties on the report elements which follows the CSS specification. The properties on various Elements depend on the type of element / type of data bound to the element as well.
Apart from this option to set formatting on every report element, BIRT also allows us to define Styles and applying the same to multiple elements. Styles may also be imported from CSS files or external CSS files can be linked to the report design.

BIRT also supports Conditional Formatting of the report elements by defining formatting rules.

BIRT has a concept of “Master Pages”. These are used to define the dimensions (page size) and styles like margins, orientation of the report pages. It has header and footer area where you can add report elements that you wish to see in the page header / footer area. You may use multiple master pages in the same report document.

This is just the most typical things, there is a lot more that can be done with BIRT and its highly customizable report elements and functionalities. Hope this gets you started on the journey to using BIRT reporting.

Shraddha Tambe | Helical IT Solutions

1. BIRT – A Field Guide (3rd Edition)
5. BIRT Developer Guide