8.2. OpenCReport element #

8.2.1. Size unit attribute
8.2.2. No query show NoData
8.2.3. Report height after last
8.2.4. Follower match single
8.2.5. Precision bits
8.2.6. Rounding mode
8.2.7. Locale
8.2.8. Translation settings

The toplevel <OpenCReport> element controls some global settings and serves as the topmost XML element for child elements.

8.2.1. Size unit attribute #

The size_unit attribute specifies report behaviour for size related settings:

<OpenCReport size_unit="'rlib'">
<OpenCReport size_unit="'points'">

Default is rlib which is the legacy RLIB behavior, where sizing of layout details are a mix of units, making it harder to design the report layout:

  • width for field and literal (see Output node) are in number of characters. This is influenced by the font size set in either Part font size, Report font size or Line font size.

  • height for Part column is measured in number of characters influenced by Part font size

  • height for Report is measured in percentage of Part column and considered to be a minimum value, so padding is added if the report contents end earlier than the limit

  • width of horizontal lines and the optional border width around reports are specified in points

  • gaps between columns of multi-column reports is measured in inches

Note that RLIB only expected monospace fonts that have the same width for every character. It also expected that the character height is identical to the character width. The latter expectation is false for many monospace fonts, i.e. their height is usually greater than their width. Also, there are problems with field widths calculated in number of characters. Widths using a 12 point font (for example, used for regular text) is not the same as widths using a 20 point font used for text in a header line. Due to this, width of header and data lines will not align properly and it will show when using background color for both of them.

With proportional fonts (where the width of characters depend on their image, i.e. an "i" is thinner than an "m") width of text fields cannot reliably be set in a "number of characters" unit because it's not an exact value. There is a workaround for this in OpenCReports but it isn't available in RLIB so it's not backward compatible. See Text element width.

When size_unit is set to points, all size related settings in the report are in points, a.k.a. 1/72th inch. It's consistent and avoids the above described issues.

8.2.2. No query show NoData #

The report uses data from Queries through the report's Query attribute. When a query provides no data rows, an alternative section called NoData node with static information may be shown instead if it exists in the report. The report uses the first query declared in Queries if it's not explicitly set via Query attribute.

RLIB had a trick to disable showing the NoData node. This was enabled by specifying a query name that does not exist. This option controls the layout behaviour for that case.

<OpenCReport noquery_show_nodata="yes">
<OpenCReport noquery_show_nodata="no">

Default is true (or yes) when <OpenCReport> is the toplevel node, false (or no) when either <Part> or <Report> is the toplevel node for RLIB compatibility.

8.2.3. Report height after last #

A report may specify its height through Report height. Multiple <Report> nodes may exist in the same <pd> section. For more information, see Part column and Report.

This option controls whether report height is applied after the last <Report> in the same <pd> node.

<OpenCReport report_height_after_last="yes">
<OpenCReport report_height_after_last="no">

Default is false.

8.2.4. Follower match single #

Queries may be daisy-chained together as Follower queries in two ways, regular and N:1 followers. See the links for details.

When set to false, N:1 followers behave fully like LEFT OUTER JOIN in SQL, with duplicating data from the primary query if multiple matching rows exist in followers. When set to true, only the first matching row is used. The latter approximates the RLIB implementation.

<OpenCReport follower_match_single="yes">
<OpenCReport follower_match_single="no">

Default is yes in RLIB compatibility mode, i.e. when either <Part> or <Report> are used as the toplevel XML node for the report description. Otherwise the default is no.

8.2.5. Precision bits #

This controls the precision for numeric computations. For more information, see Expressions

<OpenCReport precision_bits="512">

Default is 256.

8.2.6. Rounding mode #

This controls the rounding mode for numeric computations. Possible values are: nearest, to_minus_inf, to_inf, to_zero, away_from_zero, or faithful.

<OpenCReport rounding_mode="nearest">
<OpenCReport rounding_mode="to_minus_inf">
<OpenCReport rounding_mode="to_inf">
<OpenCReport rounding_mode="to_zero">
<OpenCReport rounding_mode="away_from_zero">
<OpenCReport rounding_mode="faithful">

Default is nearest. Note that according to the MPFR documentation, faithful is experimental.

8.2.7. Locale #

This controls the language settings, like the decimal separator, weekday names, month names and similar. This setting is also used as the language of translation.

<OpenCReport locale="de_DE">

Default is C locale which approximates US English.

8.2.8. Translation settings #

These two settings control the translation.

<OpenCReport
    translation_domain="mydomain"
    translation_directory="/path/to/translation/files">

Translation is based on GNU Gettext. A subdirectory tree is expected under the specified translation directory in the form of locale/LC_MESSAGES (e.g.: de_DE/LC_MESSAGES) with mydomain.mo files in them. These .mo files contain translated messages for a given language.