spagobi_server_Birt.pdf

13
SpagoBI BIRT Report Engine Alessandra Toninelli 2013/11/08 15:50

description

spagobi_server_Birt

Transcript of spagobi_server_Birt.pdf

Page 1: spagobi_server_Birt.pdf

SpagoBI BIRT Report EngineAlessandra Toninelli

2013/11/08 15:50

Page 2: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 2 - last modified by Alessandra Toninelli on 2013/11/08 15:50

Table of Contents1 What is BIRT ...................................................................................................................................................................... 32 How to design a report with BIRT ..................................................................................................................................... 33 How to configure a BIRT report in SpagoBI ..................................................................................................................... 3

3.1 Using SpagoBI Datasource in BIRT report .................................................................................................................. 44 How to attach parameters to your BIRT report .................................................................................................................. 65 How to manage Internationalization ................................................................................................................................... 66 Cross Navigation ................................................................................................................................................................. 67 Using SpagoBI Datasets in BIRT ....................................................................................................................................... 6

Page 3: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 3 - last modified by Alessandra Toninelli on 2013/11/08 15:50

SpagoBI BIRT Report Engine supports the execution of BIRT reports.

• 1 What is BIRT• 2 How to design a report with BIRT• 3 How to configure a BIRT report in SpagoBI

° 3.1 Using SpagoBI Datasource in BIRT report• 4 How to attach parameters to your BIRT report• 5 How to manage Internationalization• 6 Cross Navigation• 7 Using SpagoBI Datasets in BIRT

1 What is BIRT

BIRT is an Eclipse-based reporting system. As all common reporting systems, it has two main components:

• a report designer based on the Eclipse platform• a runtime component that runs on your application server

2 How to design a report with BIRT

In order to design a report with BIRT you have to download the BIRT Eclipse plug-in which is provided in the context ofthe Phoenix Eclipse project. You can for example donwload the 2.3.1 version of BIRT Eclipse plugin at the following URL: http://download.eclipse.org/birt/downloads/build.php?build=R-R1-2_3_1-200809221151 You can download for examplethe Windows Installer (birt-report-designer-all-in-one-2_3_1.zip) and unzip it in a local directory (e.g C:Programs).

Once you have unzipped the file, simply launch the eclipse.exe program and select the location where you want to createyour BIRT projects. Change the persepective to: "Report Design".

The main operations to create a BIRT report using the BIRT Eclipse plug-in are:

• create a BIRT project: File - New … - Project … - Business Intelligence and Reporting Tools - Report Project• create a Report under a project: File - New … - Report• create a Data Source: from the Data Explorer tab select "New Data Source" by right-clicking on the DataSources icon.

The jdbc driver you are using should belong to the path library of your Report project.

In Ubuntu the jdbc drivers must be placed in the following folder birt-runtime-yourVersionReportEnginepluginsorg.eclipse.birt.rep ort.data.oda.jdbc_yourVersiondrivers.

• create a Data Set: once you have created and tested the data source connection, create a Data Set by right-clicking onthe Data Sets icon and selecting "New Data Set"

• create your report taking fields from your DataSet.

For the complete list of BIRT reporting options and features please refer to the BIRT documentation that you can get in theHelp menu of the BIRT plug-in.

Once you have finished designing your report you can preview it and save it. All BIRT report templates are saved in fileswith the .rptdesign extension. You will find them under the BIRT project you created.

3 How to configure a BIRT report in SpagoBI

Once you have designed and saved your BIRT report using the Eclipse plug-in you can make it usable in the SpagoBIenvironment as for all other SpagoBI analytical documents.

Connect to the SpagoBI system by using a developer user id (e.g. bidev/bidev), go to the "Document development" sectionand click on the "New Document" icon on the right upper side of the windows in order to create a new analytical document.Fill in all the required fields:

• Label (mandatory)

Page 4: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 4 - last modified by Alessandra Toninelli on 2013/11/08 15:50

• Name (mandatory)• Description (highly suggested)• Type (in this case select Report)• Engine (in this case select Birt)• Data source• ...

Attach the template by browsing your file system and selecting the .rptdesign template file from the location you saved it inthe design phase with your BIRT Eclipse plugin.

3.1 Using SpagoBI Datasource in BIRT report

There are 3 ways to use a Datasource in a report BIRT:

• Set fix reference to your DB inside the report while creating your Datasource (not recommended)

• If your DataSource is defined in SpagoBI with JNDI type (RECOMMENDED). See the following example:

Add a parameter of type String in your BIRT report called connectionName. Do not assign to it any value.

Page 5: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 5 - last modified by Alessandra Toninelli on 2013/11/08 15:50

Attach the parameter connectionName to your Datasource:

This parameter doesn't need to be added in SpagoBI as Analytical Driver. It will be set by SpagoBI automatically.

• If your DataSource is defined in SpagoBI with JDBC type. See the following example:

Add 4 parameters of type String to your BIRT report named: driver , url , user , pwd. Do not assign them any value.Attach them to your Datasource as in the example above.

Page 6: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 6 - last modified by Alessandra Toninelli on 2013/11/08 15:50

4 How to attach parameters to your BIRT report

If you want to attach parameters to your BIRT report you have to work at two different stages:

• define the parameters in the design phase using the BIRT Eclipse plug-in• define the corresponding analytical driver in the SpagoBI document

When you are designing a BIRT report, in the Data Explorer Tab you will find a Report Parameters icon; you can right-clickon it and select New Parameter in order to create a parameter. Give the parameter a name, a data type, a prompt text (in ordetto test it in the BIRT Eclipse environment) and a default value. In the query in your Data Set, parameters are referred to byusing a '?' (question mark) character. After you have created your parameter you have to attach them to your Data Set. Selectyour Data Set, double click on it or select the Edit function and then select the Parameters menu in the list on the left side ofthe Edit Data Set window. Attach to each parameter of the Data Set the corresponding Report parameter paying attention tothe order in which you defined parameters (i.e. question marks) in your Data Set query.

Once you have defined parameters in the BIRT Eclipse template you may have to attach these parameters to thecorresponding SpagoBI document. In order to do this, connect to SpagoBI by using an administrator userid (e.g. biadmin/biadmin) select the SpagoBI document and then clik on "New ..." in the analytical driver section of the document in thebottom part of the SpagoBI document detail window. Select the analytical driver from your list or create it if it does notexist.

IMPORTANT: the UrlName you give to your Analytical Driver in the context of the SpagoBI document must correspond tothe name you give to the parameter in the BIRT report template

5 How to manage Internationalization

If you want to menage dynamic internationalization in you BIRT report you can choose between two modality:

• by standard labels• by local labels (with zip file)

In either way, the definition of the properties files is the same (the original Birt mode, cfr Birt documentation) … whatchanges is the location of these files.In fact these files can be in a zip file with the template (.rptdesign) and this zip will be inserted in SpagoBI like document'stemplate. Or you can insert into SpagoBI explicitly the birt report (.rptdesign) and then copy properties file in the 'resources'folder like a subfolder called 'birt_messages' (the equivalent of jasper_messages for jasper). Put attention that, in this lastway, those files are general for all documents Birt.

6 Cross Navigation

• Cross Navigation

7 Using SpagoBI Datasets in BIRT

In the BIRT Engine you can define datasets using the ones you’ve already designed in SpagoBI server.. In this way you candefine a dataset on a File, a Qbe, a query,… and use it in BIRT..

The steps to perform are very simple:

• Open SpagoBIStudio and create a new BIRT report• Define a new data source of type SpagoBI

Page 7: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 7 - last modified by Alessandra Toninelli on 2013/11/08 15:50

Page 8: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 8 - last modified by Alessandra Toninelli on 2013/11/08 15:50

• Define a new dataset of type SpagoBI. In the first page you should select the data source and give a name to thedataset. This name is used only in the BIRT designer, it’s not the name of the datset in SpagoBI.

Page 9: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 9 - last modified by Alessandra Toninelli on 2013/11/08 15:50

Click next, and in the second page insert the name of the SpagoBI dataset you want to import..

Page 10: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 10 - last modified by Alessandra Toninelli on 2013/11/08 15:50

• In the wizard you can see the output columns of the DataSet, the preview and the parameters.

Page 11: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 11 - last modified by Alessandra Toninelli on 2013/11/08 15:50

SpagoBIStudio loads the list of the parameters linked to the dataset. In the parameters tab you can give a default value tothe parameter, or you can link the parameters of the dataset to the parameters of the report. In this way when you deploy thedocument, you can use the parameters of the document as parameters of the dataset.

Page 12: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 12 - last modified by Alessandra Toninelli on 2013/11/08 15:50

Page 13: spagobi_server_Birt.pdf

spagobi_server - SpagoBI BIRT Report Engine

Page 13 - last modified by Alessandra Toninelli on 2013/11/08 15:50

Note: if you want to enable the null as admissible value for the report you should define the configuration variableDATA_SET_NULL_VALUE (with the manage configs functionalty), with the value that the parameters should take if novalue is specified