Document toolboxDocument toolbox

Use JasperReports in Identity Manager

This article describes how Smart ID Identity Manager uses JasperReports to generate reports.

JasperReports is developed by Jaspersoft. The reports are created based on templates, that are created and modified in TIBCO Jaspersoft® Studio. It produces a .jrxml file, which stores all layout information. The .jrxml file represents the report template and is stored in the file system. JasperReports fills the template with data from a data source. The user uploads the report template in Identity Manager Admin.

There are two use cases for reports:

  • Reports based on search configuration
    The report is dynamically generated depending on the search result. You can add JasperReport functionality to a search configuration in Identity Manager Admin. There you choose a JasperReport template (templateName.jrxml). The generated report will show a list of objects retrieved by the search.

  • Reports based on form content
    You can include a button to trigger the report in form designer of Identity Manager Admin. The generated report will show the content of the current data map of the process. This is useful for printing receipts or PIN letters for example.

Prerequisites

Keep track of the software versions of JasperReports and TIBCO Jaspersoft Studio to make sure your report definitions are designed for the correct Identity Manager version. You find the relevant Jasper versions for different Identity Manager releases in IDM 23.10.3 - Requirements and interoperability.



Work flow

JasperReports is a Java open source tool for generating reports for several file formats, such as PDF, HTML, XML, XLS and CSV. JasperReport uses its own XML-dialect (jrxml) for the report definition. The printable report will be generated using the jrxml file together with data from the Identity Manager database. For more information, go to https://www.jaspersoft.com/.

The preparation phase

  • The preparation phase is done in Identity Manager Admin and Jaspersoft Studio.

  • The report definition is created with Jaspersoft Studio and uploaded to Identity Manager Admin.

Work flow:

  1. Modify an existing report template (jrxml) or create a new one using Jaspersoft Studio.

  2. Save the report definition as DefinitionName.jrxml.

  3. Upload the report definition in Identity Manager Admin. Use the menu item "Reports" in the navigation.

  4. Navigate to a Search Configuration or Form button and select the uploaded report definition.

  5. Save the Search Configuration or Form definition.

The execution phase

  • The execution phase is done in Identity Manager Operator.

  • The report data is collected from the data source and generated into the report output format.

To print the search results:

  1. Do a search in Identity Manager Operator.

  2. Click Export on the search result grid, select "PDF".

  3. The JasperReport engine creates a report result as a PDF file.

To print from a form within a process:

  1. Start the process that contains the print form in Identity Manager Operator.

  2. When the form shows up, click Next and the PDF viewer will show the generated document. "Silent printing" in the background is not supported in the HTML client, because the browsers do not support this.

Set up report definitions for search configurations

In Jaspersoft Studio you can either design a report definition from scratch or open one of the predefined reports delivered with Identity Manager to adjust the layout as needed.

If you create a new dynamic report, only templates for the the first column, the header and filter parameters are defined and the actual number of needed result columns is generated during runtime according to the specifications of the search configuration. Be careful to use the exact names as described here, because Identity Manager will use them to generate the report automatically.

To create the report definition in Jaspersoft Studio, do the following:

  1. Define one column, that serves as a template for the additional columns. 
    The number of report columns to be produced depends on the column count of the search result.

  2. Define one filter field as template for all filters specified in the search configuration (if filters should be displayed).

  3. Save the report definition file.

  4.  A pre-generation-mechanism creates the report definition dynamically and adds as many columns and filters as configured in the selected query.

The names of the template fields must be:

  • filterName0  :  placeholder for the name of the search field <Parameter>

  • filterOp0  : placeholder for the name of the operator <Parameter>

  • filterValue0  : placeholder for the result of the search <Parameter>

The base elements of this generic report must be:

  • value0  :  format for a column, placeholder for all columns <Field>

  • colHeader0  : column header, placeholder for all columns <Parameter>

  • reportTitle  : Report title <Parameter>

Refer to the documentation of Jaspersoft Studio for the details on report design.

To modify the predefined report definition, do the following:

  1. Use the predefined file generic.jrxml included in the Identity Manager delivery.

  2. Open it in Jaspersoft Studio and modify it as required, but be careful to keep the fix names as described above.



In Jaspersoft Studio you can either design a report definition from scratch or open one of the predefined reports delivered with Identity Manager to adjust the layout as needed.

In a static report definition the columns are not generated by Identity Manager as in the dynamic report, but taken as they are defined in the definition file. All fields are referenced by the name, so this will provide more flexibility according to report design. The disadvantage is that the report design only fits for search configurations that deal with the same fields as in the report. For example, if the report is based on person data, it only fits for search configurations for persons.

To create the report definition in Jaspersoft Studio, do the following:

  1. Add all field definitions according to the data pool fields to the report definition, for example $F{Person_LastName}. Make sure that the report definition matches the correct data pool variable syntax, DataPoolName_FieldName, for example Person_LastName.

  2. Add the columns in the details section of the report definition referring to the fields defined.

  3. Save the report definition file.

Example:

The report definition contains three fields:
$F{Person_LastName}: LastName variable from variable map
$F{Person_FirstName}: FirstName variable from variable map
$F{Person_PersonnelNumber}: PersonnelNumber variable from variable map.

Additionally a page number should be added to the report:
$V{Page_Number}: internal Jasper variable

Refer to the documentation of Jaspersoft Studio for the details on report design.

To modify the predefined report definition, do the following:

  1. Use the predefined file person_list.jrxml included in the Identity Manager delivery as an example.

  2. Open it in Jaspersoft Studio and modify it as required.

Set up report templates with grouping

You can use grouping of search results to add sums, average or other calculations to a report. For example, group a list of cards sorted by the card type and add a total count of each card type.

To set up a report with grouping in Jaspersoft Studio is similar to setting up a plain list report like described above. For the grouping, some additional things must be added:

  • Grouping values
    Add a section "groupResult Group Header" to the report definition. Refer to the documentation of Jaspersoft how to do so.
    This section is optional. You can remove it or customize it.

  • Total grouping values
    Add a section "groupResult Group Footer" to the report definition.
    If you use any columns for grouping, the number of elements in grouping are displayed in this section.

  • In the section "Page footer" a page summary can be printed, for example the current date or the page number.

  • In the section "Summary" a total summary of the report can be printed, for example the total count of all elements.





Set up report definitions for forms

Upload the report definition in Identity Manager Admin

Use custom fonts in a report



Related information

Links

Copyright 2024 Technology Nexus Secured Business Solutions AB. All rights reserved.
Contact Nexus | https://www.nexusgroup.com | Disclaimer | Terms & Conditions