Skip to main content

Samo-reports-app-module

Header

Level: Intermediate

Keywords: application modules, LIDS reports, samo-reports

The result: integration of reports-app-module to your project

This site shows overview of how to integrate samo-reports-app-module to your project. For more information about Reporting options see page Reports. Basically, mentioned module uses JasperReports XML-files stored in project metadata package. To make samo-reports-app-module fully functional it is necessary to do three steps:

1. Template creation

First of all, you need to create JasperReports XML-file according to your needs. All templates are stored in the main project metadata package (..metadata-packages\package_name\lids-as\project\lids-as\resources\report).

Example of JasperReports XML-file with simple SQL query can be found here

2. JasperReport element definition

The second step is the definition of reportArray element in presentation.xml. You can set the default output format of the report and use input parameteres. These need to be set by user in the pop-up window, when the request is sent from the client. Currently supported data types include decimal, string, date, and codeListRefExt for codelist reference.

reportArray element — LIDS presentation.xml example
<ber:reportArray>
<ber:jasperReport id="rp_A06V01" name="Authorized explosives for first use" orientation="landscape">
<ber:groupsArray>
<ber:group id="explosives_report"/>
</ber:groupsArray>
<ber:outputFormatArray>
<ber:outputFormat default="true">pdf</ber:outputFormat>
<ber:outputFormat>html</ber:outputFormat>
<ber:outputFormat>xls</ber:outputFormat>
<ber:outputFormat>csv</ber:outputFormat>
<ber:outputFormat>rtf</ber:outputFormat>
</ber:outputFormatArray>
<ber:inputParameterArray>
<ber:inputParameter id="DATE" name="To date">
<ber:description>If you keep blank, current date will be used</ber:description>
<ber:defaultValue>
<ber:currentDate/>
</ber:defaultValue>
<ber:dataType>
<ber:date/>
</ber:dataType>
</ber:inputParameter>
</ber:inputParameterArray>
<ber:templateName>A06V01.jrxml</ber:templateName>
</ber:jasperReport>
</ber:reportArray>
warning

It is also necessary to specify which feature types the report should be used for using <ber:featureTypeArray> and <ber:featureType> elements.

reportArray element with feature type specification — LIDS presentation.xml example

<ber:reportArray>
<ber:dynamicJasperReport id="waterPipelinesReport" name="Water pipelines" orientation="landscape">
<ber:description>Dynamic Report for Water Mains with their Pipeline Segments.</ber:description>
<ber:outputFormatArray>
<ber:outputFormat default="true">pdf</ber:outputFormat>
<ber:outputFormat>pdf</ber:outputFormat>
<ber:outputFormat>xls</ber:outputFormat>
</ber:outputFormatArray>
<ber:templateName>waterMainsPipelineMasterReport.jrxml</ber:templateName>
<ber:featureTypeArray>
<ber:featureType xlink:href="model.xml#ft_5040000"/>
</ber:featureTypeArray>
</ber:dynamicJasperReport>
</ber:reportArray>

More detailed description of reportArray element can be found in LIDS Implementation Guide, chapter 18.3.1.

3. App-module configuration

The last step consists of client metadata configuration. Reports are "called" from app-module (samo-reports-content) which can be defined for each appplication part (AP) or even for a single page. To do this, you need to create appModules folder in your AP folder, then create reports.json file.

samo-reports-content module - configuration example
{
"type" : "component:entity-modules/reports/samo-reports-app-module",
"security": {
"loggedIn": true
},

"detailType" : "dropdown",
"detail" :
{
"module": {
"type": "component:entity-modules/reports/samo-reports-content",
"reportTypes": ["rp_A06V01",
"rp_A06V02"]
}
}
}

All configuration options are available in Dynamic-App Module Catalog.

tip

You can also define reportGroups in presentation.xml and then use it as input parameter instead of reportTypes. reportGroups is an element in presentation.xml.