Skip to main content

Configurable Reports

Need to easily change some details on a form? Use configurable reports that can be further edited by users

Written by Petr Pech

🧾 Configurable Reports

Do you need to easily modify certain data on forms in the ABRA Flexi system?
That is exactly what configurable reports are for — they can be adjusted directly by the user, without the need for complex programming or creating a custom report from scratch.

Configurable reports are particularly useful in situations where:

  • the standard system print layouts do not contain all the required information,

  • you need to adjust the appearance or content of a form,

  • you do not want to create a fully custom report in a technical way.


⚙️ What Are Configurable Reports

The application allows you to configure selected system and user reports.

If the system reports do not meet your needs, or if creating custom reports is too technically demanding for you, configurable reports provide a straightforward solution.

Key principles:

  • The report must be prepared to support configuration parameters.

  • System reports are prepared by the application developers.

  • User reports must be published together with specialized attachments.

  • Configurable report settings can be managed in the web interface of the application.


📄 Available Configurable Reports

The list of available configurable reports can be retrieved via the API at the following address:

/c/{firma}/configurable-reports

This list can also be viewed in the demo application.

In the initial phase, the following reports are available for configuration:

  • Issued Invoice

  • Received Order

These reports can then be modified using the configuration editor.


🗄️ Configuration Storage

Specialized URLs are available for working with the configuration of configurable reports.

📑 Report Metadata

Metadata is available at the following address:

/c/{firma}/configurable-reports/{reportId}/metadata

This metadata contains the definition of the report's configuration options.

🧩 Report Configuration

The report configuration itself can be read and written at the following address:

/c/{firma}/configurable-reports/{reportId}/configuration

The configuration contains the specific settings for the report.

🌍 Report Localization

Report localization can be read and written at the following address:

/c/{firma}/configurable-reports/{reportId}/localization

This section is primarily used for editing texts and language variants of the report.


💾 Configuration Storage Format

Configuration parameters are stored in JSON format.

For a user report, attachments with the following names are used:

File

Purpose

config.json

Report configuration

metadata.json

Report metadata

localization.json

Localization texts

These files contain the definitions used to configure the report.


💾 Saving Report Configuration

Report configuration settings can also be saved directly to the application's target storage.

For a system report, the JSON configuration is saved to the global-store record under the following key:

{kód pro tisk}-config.json

The print code {reportId} can be retrieved from the URL {evidence}/reports.xml under the property printCode.

For example, for the summarized invoice report, the resulting key will be:

favAkt:fakturaKB:SUM-config.json

🔌 Report API Adapter

For working with configuration values, an API adapter is available within the report, enabling values to be read from the configuration JSON.

The adapter is accessible via the variable _ADAPTER

<parameter name="_ADAPTER" class="cz.winstrom.service.dok.DokladReportAdapter"></parameter>

This adapter provides a set of methods for retrieving values from the configuration and using them directly within the report.

🧰 Adapter Methods

🔎 Checking for Value Existence

boolean cfgContains(String key);

Returns information about whether the configuration contains a property for the specified key.

✔️ Retrieving a Boolean Value

Boolean cfgBoolean(String key); Boolean cfgBoolean(String key, boolean defaultValue);

Used to retrieve a boolean value (true/false) from the configuration JSON.

📝 Retrieving a Text Value

String cfgString(String key); String cfgString(String key, String defaultValue);

Returns a text value stored in the configuration.

🔢 Retrieving a Numeric Value

Integer cfgInteger(String key); Integer cfgInteger(String key, Integer defaultValue);

Used to retrieve numeric values from the configuration.

📑 Retrieving Property Definitions

List<ReportProperty> cfgProperties(String key);

Returns a list of definitions for displaying properties in the report.


🧩 ReportProperty Class Methods

The ReportProperty class is used for working with individual properties defined in the configuration.

🏷️ Property Name

String getProperty();

Returns the name of the property.

🔎 Checking for Key Existence

boolean cfgContains(String key);

Checks whether the property configuration contains the specified key.

✔️ Boolean Value of a Property

Boolean cfgBoolean(String key); Boolean cfgBoolean(String key, boolean defaultValue);

Retrieves a boolean value from the configuration of a specific property.

📝 Text Value of a Property

String cfgString(String key); String cfgString(String key, String defaultValue);

Returns a text value from the property configuration.

🔢 Numeric Value of a Property

Integer cfgInteger(String key); Integer cfgInteger(String key, Integer defaultValue);

Returns a numeric value from the property configuration.

🔠 Bold Display of a Value

boolean isBold();

Determines whether the value should be displayed in bold in the report.


📄 Sample Configuration Definition

The following JSON configuration example demonstrates several report customization options:

  • changing the font color,

  • logo position,

  • margin width,

  • defining three fields in the left column of the form.

Specifically, these fields are:

  • issue date

  • street

  • data mailbox

{
"replaceWhiteFontWithBlack": true,
"logoPosition": "left",
"borderWidth": 20,
"addonFields.left": [
{
"property": "datVyst",
"bold": true,
"width": 50,
"align": "right"
},
{
"property": "firma.ulice"
},
{
"property": "nastaveni.datovaSchranka",
"italic": true
}
]
}

🧪 Sample Usage in a Report

The following example shows how configuration is used directly in the report source code.

<conditionalStyle>
<conditionExpression>
<![CDATA[$P{_ADAPTER}.cfgBoolean("replaceWhiteFontWithBlack", false)]]>
</conditionExpression>
<style forecolor="#010101" backcolor="#0092FF"/>
</conditionalStyle>

This notation means that the style will only be applied if the configuration contains the value replaceWhiteFontWithBlack set to true.


🌍 Report Localization

The following file is used to define localization texts:

localization.json

🗝️ Standard Localization Keys

Standard localization uses a key in the following format:

{localeCode}.{groupName}.{subgroupName}.{itemName}

🧾 Object Localization

For localizing a specific object, the following key is used:

{localeCode}.{className}.{code}

📄 Sample Localization Definition

The following localization example defines the translation of the page field and the CZ country in Czech:

{
"cs.reports.faktura.stranka": "~ Stránka ~",
"cs.Stat.CZ": "Země koruny české"
}

🧪 Sample Localization Usage

Using localization in the report source code might look like this:

<textFieldExpression>
<![CDATA[$P{_ADAPTER}.getTitle( $P{_LOCALE}.GID_REPORTS, "faktura", "stranka", false)]]>
</textFieldExpression>
<textFieldExpression>
<![CDATA[$P{_ADAPTER}.getLocalizedText( $F{stat}, new java.util.Locale($P{_LOCALE}.getLocaleCode()))]]>
</textFieldExpression>

This notation ensures that the text will be automatically translated according to the current system language.


❓ Frequently Asked Questions

  1. How do I find the report code (reportId)?

The code can be found at the following address:

{evidence}/reports.xml

under the property printCode.

2. Can any report be configured?

No. The report must be specifically prepared to support configurable parameters. If it has not been prepared this way, it cannot be modified using this method.

3. How do I find the list of available configurable reports?

Using the API endpoint:

/c/{firma}/configurable-reports


Need help?
If you have any questions about the application, please contact us at podporaflexi@abra.eu or via the chat window in the bottom right corner.

Did this answer your question?