IReport

Un article de Bluexml.com.

Home Official WebSite Download Forum

This article describes how to create a report with IReport and an Alfresco XML data file

Configuring the data source

To add a new Data Source, follow the step below :

1. Click Data and select Connections/Data Sources.

Image:Data_source.JPG

2. In the Connections/Datasources window, click New to create a new Data Source.

Image:Ireport_connections.jpg

3. In the Connections properties window, select XML file data source and click Next.

Image:Ireport_connections_properties.jpg

4. In the Connections properties window, enter the following parameters :

  • Name : My data source
  • XML file : C:\Documents and Settings\GMA\Bureau\openbluelab_personne_Person.xml

Precise the place where is your Alfresco XML file

  • Select Expression : /records/items/item
Image:Ireport_properties.jpg

records : root element

items : top level grouping of item

item : contains information about the object Person


Example of an Alfresco XML file

<records>
 <type>openbluelab_personne_Person</type>
 <qName>org:openbluelab_personne_Person</qName>
 <totalCount>2</totalCount>
 <items>
   <item>
     <id>895d15a7-2590-11dd-a903-e1c64638a05d</id>
     <url>/d/d/workspace/SpacesStore/895d15a7-2590-11dd-a903-e1c64638a05d/895d15a7-2590-11dd-a903-e1c64638a05d</url>
     <displayPath>/company_home/Espace invité</displayPath>
     <icon16>/images/filetypes/_default.gif</icon16>
     <icon32>/images/filetypes32/_default.gif</icon32>
     <nodeRef>workspace://SpacesStore/895d15a7-2590-11dd-a903-e1c64638a05d</nodeRef>
     <parent>workspace://SpacesStore/24ca5a1f-2582-11dd-8cc1-4b617ccb017e</parent>
     <openbluelab_personne_Person_lastName>Duchamp</openbluelab_personne_Person_lastName>
     <openbluelab_personne_Person_firstName>Pierre</openbluelab_personne_Person_firstName>
     <openbluelab_personne_Person_title>M.</openbluelab_personne_Person_title>
     <openbluelab_personne_InformationLocation_address>45 rue du Pont</openbluelab_personne_InformationLocation_address>
     <openbluelab_personne_InformationLocation_zip>56000</openbluelab_personne_InformationLocation_zip>
     <openbluelab_personne_InformationLocation_country>France</openbluelab_personne_InformationLocation_country>
   </item>
 <item>
</records>


5. Click Save

Adding Data Set

To add data set, follow the step below :

1. In the Document structure view, right-click on Field and select Add/Field.

Image:Ireport_add_field.JPG

2. In the Add/modify window enter the following parameters:

  • Field Name: Last Name
  • Field Description: openbluelab_personne_Person_lastName

It is the name of the tag in the Alfresco XML file

Image:Ireport_field01.jpg

3. Click OK

Image:Ireport_field02.jpg

4. Drag and drop fields to the report

Image:Ireport_add_field_report.jpg


Viewing the report

To view the report, click on the button Execute (with active connection).

Image:Ireport_execute.JPG


Image:Ireport_view.jpg