Smarten up your data again!

Tutorial: Eclipse BIRT Designer Perspective

On Tuesday, we were introduced to the BIRT engine pipeline. This time round, Jason Weathersby and Ray Gans look at each of the Eclipse Views that make up the BIRT Designer Perspective. This article previously appeared in JAX Magazine:Pulling Together

The BIRT Designer Perspective is constructed using a set of Eclipse Views. These Views are the Outline, Palette, Report Editor, Data Explorer, Resource Explorer, and Property Editor. Each of these Views is explained and detailed in the following sections.

BIRT Report Editor View

The BIRT Report Editor View (as shown in Figure 1) represents the canvas where report items are placed and configured. This view contains several tabs across the bottom of the editor. Table 1 details the function of each of the tabs.

Figure 1: Report Editor
Report Editor Tab Function

 The Layout Tab functions as the report canvas and also supports drag and drop from the palette and the resource explorer.

Master Page  BIRT supports creating one or more master pages for a report. The master page is used to configure content on a page basis and supports headers, footers, margins, sizes, and orientation. In addition multiple master pages can be used within a report and assigned to specific report items. For example one table in a report may be displayed in portrait mode while another may be displayed in landscape. The Master Page tab allows the developer to edit one or more master pages.
 Script  The Script tab opens the BIRT JavaScript editor for a selected report item. See event handling in part 1 of this article series.

 XML Source

This view displays the actual generated XML for the current report. The XML can be modified as well. This view will also supply a red x icon next to lines within a report that are currently in error.  
 Preview  This tab allows the current report to be previewed. The report can also be previewed from the toolbar, as shown in Figure 2, allowing the developer to see what the report will look like in a specific output format.


Figure 2: Report Toolbar Output

BIRT Data Explorer View

Before building a report, you will need access to data. The Data Explorer view (Figure 3) is used to construct data sources and data sets, which represent connections to a specific data source type and a tabular set of data, which is returned from the data source. A data set returns a tabular list consisting of rows and columns much like a result set of a SQL query. 

Figure 3: Data Explorer View

BIRT currently supports JDBC (textual and graphical), Web Services, XML, Flat File, Excel, and Hive/Hadoop data sources (Editor's Note - and now MongoDB/Cassandra in newest version).

In addition BIRT supports a scripted data source that allows the user to develop a custom data source, using JavaScript or Java to return data results. The properties for these data sources can also be customized at runtime using a feature called Property Binding built with the Expression Builder or with the use of a simple JavaScript event handler.

In both cases, the property is set with a small amount of JavaScript. For example, to change the database URL of a JDBC data source in a report, the following JavaScript could be used in the beforeOpen event of a JDBC data source.


extensionProperties.odaURL = "jdbc:mysql://localhost/"+params{“mydbparameter”];


When building a data source, the developer also has the option to create the connection from an externally stored profile. This allows connection credentials to be managed separately from the report design. 

Developers can extend and create new BIRT data sources using extension points provided by the Data Tools Project. These extension points not only provide extensions to the data access engine but also allow developers to create custom GUIs that the BIRT designer will launch. Once developed these new data sources can be easily deployed to any BIRT designer. Many examples of these custom data sources (ODA –Open Data Access) drivers are available at BIRT Exchange.

The Data Explorer View also allows the creation of data cubes. Cubes (shown in Figure 4) analyze complex hierarchical data but can also be used in conjunction with charts and the crosstab report element. BIRT data cubes are multi-dimensional cubes, based on one or more BIRT datasets, constructed using the Data Cube Builder. BIRT Cubes support dimensions –static and dynamic, measures, derived measures and filters.

Figure 4: BIRT Data Cubes

We’ll cover more details on the crosstab and chart report elements within the Palette View section.

BIRT provides two types of parameters –Report Parameters and Data Set Parameters. Report parameters are global to the report and are generally exposed to the end user.

Data Set Parameters differ in that they are used to make Data Sets more dynamic, and are not generally exposed to the end user. Data Set Parameters can be linked within the Data Set Editor to Report Parameters or set using script or expressions. Report parameters are created in the Data Explorer View and are often used to personalize the report for a given user. Report parameters for example, can be tied to Data Set Parameters to modify a query, used in a BIRT JavaScript expression to change the style and visibility of a report element. They can also be used within a script event to personalize the content based on the selected output format. 

Report parameters can be static or dynamic. Static parameters are parameters that allow the user to select from a predefined set of values or to enter a desired value, for example, in a text box. Dynamic parameters are parameters that can be data bound to an existing BIRT data set. For example, a user may select a customer from a list of customers provided by a data set. Dynamic parameters can also be scripted to allow the developer to decide which values will be displayed to the end user. 

In addition, BIRT supports cascading parameters that allow multiple list/combo boxes to be displayed with each subsequent selection list being modified by previously selected values. So, a cascaded parameter could present an alpha list in the first list box and the customer names starting with the selected alpha character in the second list box. Cascaded parameters can be created using one or more BIRT Data Sets. 

The Variables node of the Data Explorer view is used to create a special type of pagination variable which can be one of two types: Report Variable or Page Variable

Report Variables are evaluated when the report is complete while Page Variables are evaluated at the time a page is created. Either type can be placed on the master page by selecting the Palette View and selecting the Variable AutoText field when using the master page editor. While these page variables can be accessed by Expressions and JavaScript their main use is when creating page specific calculations. For example, creating a page n of m for specific groups within a report. These variables are generally set using page script event handlers (onPageStart and onPageEnd events). 



Jason Weathersby
Jason Weathersby
Ray Gans
Ray Gans

What do you think?

JAX Magazine - 2014 - 06 Exclucively for iPad users JAX Magazine on Android


Latest opinions