Report Layout design and programming

A Report Layout object is a GeneXus procedure that has the Is layout property set to true. They are ment to be used as design and programming templates to generate PDF reports (see PDF report generation for details).

A knowledge base can have many Report Layout objects. In fact K2BTools distributes several ones the developer can choose from.

The default Report Layout to be used is defined in the Report section of K2BEntityServices Settings. Developers can override the default value on every instance of a WorkWith or SubWorkWith to match their needs.

Designing layout

A Report Layout object defines several aspects of the generated report. For example, if and how filters are used, if and where titles are shown, headers, footers, etc.

The Layout part of a Report Layout defines the aspect AND the content of the resulting report. It has properties (see Layout properties in Procedure Layout) and print blocks that have controls.

Properties relevant to the Report Layout:

Property What for? Can be overwritten

Paper size

To set the default paper size of the resulting report

At the instance level

Paper orientation

To set the default paper orientation of the resulting report

At the instance level

The following named print blocks are relevant to the Report Layout. These print blocks and those referenced by the source code are the only ones copied to the generated report.

  • Print block order is not relevant

  • Optional printblocks may not be defined. If so, the resulting report will not include them.
    For example, if the HeaderBlock is not present in the layout, the generated report does not include one.

  • Mandatory (non optional) print blocks need to be defined. If not, the Report Layout procedure cannot be saved.

Print block name Optional Usage

HeaderBlock

yes

Report header. Printed on every page, if present.

FooterBlock

yes

Report footer. Printed on every page, if present.

FirstPageTitleBlock

yes

First page header. Printed after the report header in the first page, if present.

BeforeFiltersBlock

yes

Printed before all filters, if present

FilterBlock

yes

Defines how to print each filter value, if present. The print block should have, at least, a FilterText and an &FilterValue controls (see below).
The print block describes one filter. Multiple filters can be shown in the same row by changing the Report filter columns by row property.

AfterFiltersBlock

yes

Printed after all filters, if present

NotAuthorizedBlock

no

Printed when there is no authorization to view the report

RowTitlesBlock

no

Defines how row titles are shown. Must contain a RowTitles control (see below).

RowValuesBlock

no

Defines how row values are shown. Must contain a RowValues control (see below).

EvenRowValuesBlock

yes

Defines how even row values are shown, if present. Must contain a RowValues control (see below).

MultiLineBlock

yes

Used when there are items that span among multiple lines (a Long varchar value, for example).

Defines how lines other than the first one are shown, if present.

EvenMultiLineBlock

yes

Used for even rows, when there are items that span among multiple lines (a Long varchar value, for example).

Defines how lines other than the first one are shown, if present.

MultiLineSeparatorBlock

yes

Used when there are items that span among multiple lines (a Long varchar value, for example).

Defines the aspect and spacing between rows, if present.

BeforeRowValuesBlock

yes

Prints before each RowValuesBlock print block is printed, if present.

AfterRowValuesBlock

yes

Prints after each RowValuesBlock print block is printed, if present.

Used to print, for example, a line between rows.

AggregationsBlock

yes

Defines the size of each aggregation line, if present. Must contain AggregationTitle and AggregationValue controls.

Any of the above print blocks can include any supported Print Block control (i.e. Attribute, Variable, Text Block, Image, Line, etc.). There are a few named controls that have special meaning when included in the appropiate print block:

Control Optional Usage

TitleText text block

yes

Replaced with the report title in any print block. Can be used in more than one print block.

FilterText text block

yes

Replaced with the filter text (description) in FilterBlock print block only

&FilterValue variable

yes

Replaced with the filter value in FilterBlock print block only

RowTitles

no

Specifies the aspect (font, colors, etc.) and position of grid titles in the RowTitlesBlock print block. Each column title has exactly the same properties as this control except for the width that is set as needed.

The first (leftmost) column title is placed at same X position as this control. Following titles are placed one after the other horizontally setting a gap between then equal to the value of Report space between columns property.

RowValues

no

Specifies the aspect (font, colors, etc.) and position of grid values in the RowValuesBlock and EvenRowValuesBlock (when defined) print blocks. Each value has exactly the same properties as this control except for the width that is set as needed.

The leftmost position of this control is ignored. It is taken from RowTitles.

AggregationTitle

no

Specifies the format of aggregation titles. It is mandatory in the AggregationsBlock, if defined.

Position and size properties are ignored.

AggregationValue

no

Specifies the format of aggregation values. It is mandatory in the AggregationsBlock, if defined.

Position and size properties are ignored.

Source part

The source part of the Report Layout can have any of the following subroutines that are automatically invoked, if present.

This process is equivalent to the one described in Export Layout. This is why the term “Grid” is used in the subroutine’s names.

Code outside these subroutines is ignored.

Subroutine Name

Execution moment

'BeforeInitialization'

After permissions are checked, before loading context.

'AfterInitialization'

After initialization of all variables used in the object.

'BeforeTitle'

Before printing the first report title.

'BeforeFilters'

After printing the Title, but before printing the applied filter values.

'BeforeGridTitles'

Before printing the titles of the first page.

'BeforeGridRow'

Before printing a row.

'AfterGridRow'

After printing a row.

'AfterGrid'

After all rows were printed.

Variables part

All non standard variables in the Report Layout are copied to the generated report.

Backward compatibility

This section discuses compatibility issues related to changes made to the PDF report generation as of version 15.1.

The following print blocks were renamed. They are automatically renamed when reports are regenerated unless they are not set to their default value (manually maintained). If this is the case, please rename as needed.

Previous name

New name

printBlock_Header

HeaderBlock

printBlock_Footer

FooterBlock

printBlock_Columns

RowTitlesBlock

PrintBlock_Rows

RowValuesBlock

Source code

The source code is no longer copied “as is” to the generated procedure. Please read the Source part section above.

Layout part

Not all print blocks in the Report Layout are copied to the generated report. Please read the Layout part section above.

Changing customized report layouts

If an application has a customized report layout, it is necessary to update it to match the current requirements (i.e. print blocks, controls, etc).

Set it as a Report Layout object by setting the Is Layout object property? to true and try to save it. Errors and warnings are shown that may guide you through the update process.

Alternatively, save the default Report Layout object (ReportWWLayout) as a new object and change it accordingly.

K2B Entity Services Settings/Report properties

Many properties were removed from this area their value is now taken from the report layout:

Property

Value taken from

Paper type

Paper type property of Layout part in Report Layout object

Orientation

Paper orientation property of Layout part in Report Layout object

Left margin

X position of RowTitles text block in RowTitlesBlock print block

Right margin

Paper with - (X position + Width of RowTitles text block in RowTitlesBlock print block)

Title line width

No default. Add a line to the RowTitlesBlock if required

Columns line width

No default. Add a line to the RowTitlesBlock if required

Print block title height

Height of FirstPageTitleBlock print block

Print block Not authorized height

Height of NotAuthorizedBlock print block

Print block filter height

Height of FilterBlockprint block

Print block columns height

Height of RowTitlesBlock print block

Print block rows height

Height of RowValuesBlock print block