8.9. Report #

8.9.1. Report attributes
8.9.2. Report subsections

This section may occur in a wider context or standalone in an OpenCReports XML report description file.

Example XML skeleton structure with <OpenCReport> as the toplevel node:

<OpenCReport>
    <Part>
        <pr>
            <pd>
                <Report>
                    ...
                </Report>
            </pd>
        </pr>
    </Part>
</OpenCReport>

Example XML skeleton structure with <Part> as the toplevel node:

<Part>
    <pr>
        <pd>
            <Report>
                ...
            </Report>
        </pd>
    </pr>
</Part>

Example XML skeleton structure with a standalone <Report> node:

<Report>
    ...
</Report>

When <Report> is the toplevel node, parent nodes for <Part>, <pr> and <pd> are implicitly created. Subsections and many attributes specific to these parent nodes can be used as shortcuts in the <Report> node.

8.9.1. Report attributes #

Note that any attribute setting below may only use constant expressions or an query column reference from Independent queries. An environment variable (since it can't - or shouldn't - change during the report execution) is considered constant. See Expressions. This allows external control for the attributes in question.

8.9.1.1. Font name #

The font name attribute specifies the font for the report's scope. It can be overridden by child nodes for their scope. It may be specified in two forms, the first one is the preferred name, the second is for RLIB compatibility:

<Report font_name="'Arial'">
<Report fontName="'Arial'">

If both forms are specified, font_name is used.

Default font name is what's set for Part font name, or Courier if both are unset.

8.9.1.2. Font size #

The font size attribute specifies the font size for the report's scope. It can be overridden by child nodes for their scope. It may be specified in two forms, the first one is the preferred name, the second is for RLIB compatibility:

<Report font_size="10">
<Report fontSize="10">

If both forms are specified, font_size is used.

Default font name is what's set for Part font size, or 12 if both are unset.

8.9.1.3. Size unit #

Shortcut for the Size unit attribute in <OpenCReport> when <Report> is the toplevel node.

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

When <OpenCReport> or <Part> is the toplevel node in the report XML description, this attribute for <Report> is ignored.

8.9.1.4. No query show NoData attribute #

Shortcut for No query show NoData attribute in <OpenCReport> when <Report> is the toplevel node.

<Report noquery_show_nodata="yes">
<Report noquery_show_nodata="no>

See default in No query show NoData attribute See also NoData node.

8.9.1.5. Report height after last attribute #

Shortcut for Report height after last attribute in <OpenCReport> when <Part> is the toplevel node.

<Report report_height_after_last="yes">
<Report report_height_after_last="no">

See default in Report height after last attribute See also NoData node.

8.9.1.6. Orientation #

Shortcut for Part page orientation for the implicitly created parent <Part> node when <Report> is standalone.

<Report orientation="'portrait'">
<Report orientation="'landscape'">

Default is portrait orientation.

This setting for <Report> is ignored when there is a parent <Part> node in the XML description.

8.9.1.7. Margin settings #

Shortcuts for Margin settings for the implicitly created parent <Part> node. Individual settings exist for the top, bottom, left and right margins of the page. Every setting exist in two forms: the RLIB compatible "lowerCamelCase" variant and the all lowercase with underscore. The lowecase-with-underscore variants are the preferred ones.

<Report top_margin="0.2">
<Report topMargin="0.2">
<Report bottom_margin="0.2">
<Report bottomMargin="0.2">
<Report left_margin="0.2">
<Report leftMargin="0.2">
<Report right_margin="0.2">
<Report rightMargin="0.2">

When size_unit="'rlib'" is in effect (the default case) the margin unit is inches. The margin unit is points (1/72th inches) when size_unit="'points'" is in effect.

Default values for the top, bottom, left and right margins are all 0.2, regardless of the unit.

Note that rightMargin didn't exist in RLIB.

These settings for <Report> are ignored when there is a parent <Part> node in the XML description.

8.9.1.8. Paper type #

Shortcut for Paper type for the implicitly created parent <Part> node. It exists in two forms: the RLIB compatible "lowerCamelCase" variant and the all lowercase with underscore. The lowecase-with-underscore variant is preferred.

<Part paper_type="'A4'">
<Part paperType="'A4'">

Default value is the current system paper type that libpaper uses. E.g. if the system is set to US English, the default paper type is implicitly letter. In most of Europe, the default paper type is A4

The paper type can be specified in either lower case or upper case, both are accepted.

This setting for <Report> is ignored when there is a parent <Part> node in the XML description.

8.9.1.9. Height #

Height of the report.

<Report height="120">

This setting is interpreted differently depending on whether the report XML description uses <OpenCReport> as the toplevel node, or it uses either <Part> or <Report>.

8.9.1.9.1. Report height in OpenCReports mode #

When Size unit attribute is set to rlib (the default), the report height is measured in characters, which is controlled by Report font size. Note, that the font width and height may differ, depending on the font face controlled by Report font name. Report height is computed from the font height.

When Size unit attribute is set to points, height is measured in points.

Report details are layed out up to the specified height. If the report would run longer than the specified height, it gets truncated. When the report fits in the specified height, the next report starts with the remaining height added as padding before it.

If the <Report> is the last one in the <pd> node, then the report may or may not be padded with the remaining height, depending on the Report height after last attribute.

If height is unset for the parent <pd> node, it is expanded with this vertical padding.

In case height is set for both the parent <pd> node and the <Report> nodes in it, the height value for <pd> is applied first. It would limit the displayed rows in whichever <Report> node is terminated by it. Subsequent <Report> nodes would no be displayed in that <pd> node.

Note, that OpenCReports allows fixed-height reports to break over page boundaries. This is a deviation from RLIB.

8.9.1.9.2. Report height in RLIB compatibility mode #

When parsing XML descriptions from RLIB, i.e. when either <Part> or <Report> is used as the toplevel node, compatibility mode is turned on for interpreting this setting.

In this mode, the report height is interpreted as a percentage of the height set in Part column height attribute. In this case, the report height setting is a hint, to use it as minimum height. If the <Report> is rendered on the same page from start to end, and is shorter than the height of the parent <pd> node, then a gap is added to the <Report>. If there are multiple <Report> nodes in the same <pd> node, this will separate them visually.

Note, that this behaviour is not available when using the programming API to create a report. It's only for RLIB compatibility which relied only on the report XML description file.

8.9.1.10. Iterations #

The same <Report> may be executed multiple times.

<Report iterations="3">

Default value is 1.

8.9.1.11. Suppress #

Reports may be suppressed.

<Report suppress="yes">

Default value is false, i.e. no suppression.

8.9.1.12. Suppress page header on the first page #

Shortcut for Suppress page header on the first page in the implicitly created parent <Part> node when <Report> is the toplevel node.

<Report suppressPageHeaderFirstPage="yes">

Default value is no.

This setting for <Report> is ignored when there is a parent <Part> node in the XML description.

8.9.1.13. Query #

Set the primary query name for <Report> from the list of Queries.

<Report query="query1">

Default value is unset, i.e. use the first query from the list of Queries.

Column references of the report's primary query and its follower queries may be used in Expressions of Output node sections in a <Report> node: Report page header, Report page footer, Report header, Report footer, <FieldHeaders> and <FieldDetails> in Detail node, and also in Break nodes and Variable nodes.

When a query is empty (i.e. it doesn't have data rows) then the NoData node will be shown.

When the query name is set to a non-existing query, then the appearance of the NoData node is controlled by No query show NoData attribute.

8.9.1.14. Field header priority #

Set the field header priority for the report versus break (header and footer) priority. This setting selects which report detail is encompassing the other.

<Report field_header_priority="'low'">
<Report field_header_priority="'high'">

Default value is high. In this mode, the field header is printed on the top of every page of the report and break headers and footers are encompassed by it. The default is chosen for RLIB compatibility.

When this setting is low, field headers are handled with lower priority compared to break headers and footers. In this mode, a break header is followed by the field header, then data rows (field details), followed by the break footer. This brings the field header closer to the field details.

8.9.1.15. Border width #

This is a shortcut for Part column border width for the implicitly created <pd> node when <Report> is standalone. It is measured in points.

<Report border_width="2">

When set, a rectangle around the part column (in this case, around the single report in the part column) will be drawn. The width of outline of the rectangle is measured in points.

This is a deviation from RLIB where the width of the outline was a fixed 0.1 points and an inner margin (all of top, bottom, left and right) inside the column border was used. Also, this shortcut didn't exist in RLIB, the <pd> node had to be present.

If the report (column) breaks over a page boundary, the border will be drawn the column parts on every page.

This setting for <Report> is ignored when there is a parent <pd> node.

8.9.1.16. Border color #

This is a shortcut for Part column border color for the implicitly created <pd> node when <Report> is standalone. When border_width is set, this color is used to draw the border rectangle.

<Report border_color="'blue'">

See Color specification.

8.9.1.17. Detail columns #

Shortcut for Detail columns in the implicitly created parent <pd> when <Parent> is the toplevel node.

<Report detail_columns="3">

Default value is 1.

This setting for <Parent> is ignored when there is a parent <pd> node in the report XML description.

8.9.1.18. Column padding #

Shortcut for Column padding in the implicitly created parent <pd> node when <Parent> is the toplevel node.

<Report column_pad="0.2">

Default value is 0, i.e. no padding.

The unit of padding is inches if Size unit attribute is set to rlib (default), points otherwise.

8.9.2. Report subsections #

8.9.2.1. Page header #

This may be seen as a shortcut for Page header in the implicitly created <Part> node when <Report> is standalone. Except that report query column references are also allowed in expressions instead of only constants and column references of Independent queries. It contains an Output node.

<Report>
    <PageHeader>
        <Output>
            ...
        </Output>
    </PageHeader>
</Part>

This subsection for <Report> is ignored when there is a page header section defined for the <Part> node, either in the <Part> node itself or in a previous child <Report> node for the same <Part>. A warning is issued in this case.

8.9.2.2. Page footer #

This may be seen as a shortcut for Page footer in the implicitly created <Part> node when <Report> is standalone. Except that report query column references are also allowed in expressions instead of only constants and column references of Independent queries. It contains an Output node.

<Report>
    <PageFooter>
        <Output>
            ...
        </Output>
    </PageFooter>
</Part>

This subsection for <Report> is ignored when there is a page footer section defined for the <Part> node, either in the <Part> node itself or in a previous child <Report> node for the same <Part>. A warning is issued in this case.

8.9.2.3. Report header #

This is the description of the report header that is print at the beginning of the report. It contains an Output node.

<Report>
    <ReportHeader>
        <Output>
            ...
        </Output>
    </ReportHeader>
</Part>

8.9.2.4. Report footer #

This is the description of the report footer that is printed at the end of the report. It contains an Output node.

<Report>
    <ReportFooter>
        <Output>
            ...
        </Output>
    </ReportFooter>
</Part>

8.9.2.5. Variables #

This section describes the Variables in the report.

<Report>
    <Variables>
        <Variable ... />
        ...
    </Variables>
</Part>

8.9.2.6. Breaks #

This section describes the Breaks in the report.

<Report>
    <Breaks>
        <Break ... >
            ...
        </Break>
        ...
    </Breaks>
</Part>

8.9.2.7. Detail #

This section describes the tabular details of the report. There are two subsections in this node, both contain an Output node.

<Report>
    <Detail>
        <FieldHeaders>
            <Output>
                ...
            </Output>
        </FieldHeaders>
        <FieldDetails>
            <Output>
                ...
            </Output>
        </FieldDetails>
    </Detail>
</Part>

<FieldHeaders> is used to describe the header for data rows.

<FieldDetails> is used to show data that is derived from the current data row produced by the report query.

8.9.2.8. Alternate output for no data #

This section describes the alternate output of the report when the query has no data rows, or there is no such query name defined that's set in Report query name. It contains an Output node.

This section may be declared in two ways. One way is to spell out the <Alternate> node:

<Report>
    <Alternate>
        <NoData>
            <Output>
                ...
            </Output>
        </NoData>
    </Alternate>
</Part>

The other way is without the <Alternate> node:

<Report>
    <NoData>
        <Output>
            ...
        </Output>
    </NoData>
</Part>

When the Report query name does not exist in in the global list of Queries and the No query show NoData attribute is set, then the <NoData> section is not displayed.