Developer Handbook
  • 22 May 2023
  • 4 Minutes To Read
  • Dark
    Light
  • PDF

Developer Handbook

  • Dark
    Light
  • PDF

Article summary

Learning about Jasper

You can use the following tutorials and user guides to learn about Jasper:

Predefined Reports

Jaspersoft offers a set of examples and usage details about reports packed into a project. These details cover the main available features case by case. Download the project and explore it to see how different widgets can be used and how your reports can look like. Follow the tutorial to get examples compiled and filled with data.

Using Jasper with Mambu

Furthermore, you can learn about using Jasper with Mambu in the following sections.

Data Dictionary

Creating Jasper reports requires working with the Mambu database. We maintain a data dictionary with the tables and the relations between them. Explore each table: from its purpose, to its columns, types, and required data. A few charts also offer an overview of the most common entities. We recommend exploring the dictionary before you start working with Jasper reports.

Parameter Types

Parameters are used as input values for reports. They can be used to filter the results of Jasper to pass some data to be included. Mambu supports the parameter types:

  • String
  • Date
  • Boolean
  • Integer
  • Decimal
  • Double

To use them, you have to declare the Jasper parameter of the equivalent Java type (like java.util.Date for the Date type). The result will be seen when opening the report's overview, where the input will be rendered in the according widget, such as the Date widget. The type is used in the input validation process, each one allowing only the intended values.

These parameters can also have a description, displayed in Mambu as a label, to be clear in purpose.

Default Parameters

Mambu offers support for a few predefined parameters. These parameters, when used in specific contexts, get automatically completed at runtime.

For example, let's assume a BRANCH_ID parameter is built into the logic of a report and the report associated with the Branch category so that it is available at the branch level. When running the report from the context of a branch, from its overview, Mambu will populate the ID without further input required from the user. If the same report is run directly from the Administration panel, the ID will have to be added by the user, as there is no branch context there.

The following preview shows a report containing both predefined and regular parameters or go further and try the Transactions per Account report example on your own.

Please note

Parameters are case sensitive and in most cases should be written in ALL_CAPS with underscore used to separate words instead of any spaces, eg. INTEREST_APPLIED and not interest applied.

The names of the parameters should also be identical when declared in a Jasper report. For example the BRANCH_ID parameter should have the P{BRANCH_ID} signature.

Check out the supported list of predefined parameters by report type:

  • Clients/Groups
    • CENTRE_ID, CENTRE_KEY / GROUP_ID, or GROUP_KEY
  • Branches/Centres/Users
    • BRANCH_ID, BRANCH_KEY / CENTRE_ID, CENTRE_KEY / USER_ID, or USER_KEY
  • Loan Accounts/Deposit Accounts
    • ACCOUNT_ID, and ACCOUNT_KEY
    • CLIENT_ID, CLIENT_KEY, or GROUP_ID, GROUP_KEY
  • Loan Groups
    • ACCOUNT_KEY
    • GROUP_ID, or GROUP_KEY
  • Loan Transactions/Deposit Transactions
    • TRANSACTION_ID, or TRANSACTION_KEY
    • ACCOUNT_ID, or ACCOUNT_KEY
    • CLIENT_ID, CLIENT_KEY, GROUP_ID, or GROUP_KEY
Warning!
Do not include Schema names when developing new Jasper reports. Due to security reasons, the system does not support schema names.

Allowed MySQL variables and functions

Starting with Mambu v9.63, in order to add new mySQL variables and ensure these are allowed in running Jasper Reports, make sure you use the mbu_ prefix. For example, if you want to add @myvariable, you need to name it @mbu_myvariable. All previously used variables have been verified and added to our 'Allowed variables' list and existing variables will continue to be supported.

Most MySQL functions that are secure will be executable, for more information, see MySQL Functions and Operators on the MySQL website.

Allowed Java and Groovy classes

Starting with Mambu v9.63, in order to ensure continuity for your Jasper Reports, make sure the Java and Groovy classes you use are included in the Jasper Reports' built-in functions or check that they are present in our 'Allowed List'.

We have also put together a list of 'Allowed Java/Groovy classes'. This list can be found in Jasper Reports built-in functions.

java.lang.StringBuffer
java.lang.Boolean
java.lang.Double
java.lang.Byte
java.lang.Float
java.lang.Integer
java.lang.Long
java.lang.Math
java.lang.Number
java.lang.Short
java.math.*
java.time.*
java.text.*
com.mambu.number2words.api.factories.NumberTranscriberFactory.*
java.util.Date
java.util.Locale
java.util.Calendar
java.util.UUID

Jasper report configuration

The results are returned a pages of 10 000 items per page. To avoid the results being unexpectedly truncated, make sure to build a pagination algorithm when working with larger data sets.

Supported Fonts

Mambu currently supports the use of the following fonts:

  • Deja Vu Serif
  • Deja Vu Sans
  • Deja Vu Sans Mono
  • Myanmar3 (regular type only)
  • Sans Serif (default font, not available for export)

These fonts display as expected when a Jasper report is exported to PDF or other file formats.

Please Note
Jasper Studio uses two sets of fonts: fontName and pdfFontName. These settings are visible in the advanced section of the element. These fonts can be configured independently, which means that the report can render fine in a preview, but break when exporting to PDF if the font is not available. For more information about fonts, see Text Elements section of the Jasper Reports Ultimate Guide.

Troubleshooting

If you want to use a function, but you get a 'Not Allowed' error or you have any other issue in the Jasper Reports, please contact us through Mambu Support.


Was this article helpful?

ESC

Eddy, a generative AI, facilitating knowledge discovery through conversational intelligence