# Creating the Report Layout

Selecting Report Elements |

The report layout is created by selecting data elements from the list on the left side of the Report Designer and dragging them to the layout area on the right side.

Data elements include System Values, Input Source Elements, Related Data Source Elements, Calculated Fields, Parameter Values and Group Functions.

Whenever an item from the list is dropped on a cell, a formatting mask is displayed in the cell, and a red tick mark is drawn in the cell's bottom left corner to indicate that this is a placeholder for a data element. Floating tips identify each of the items. You can select the cell to display and edit the underlying data element.

#### Note:
Right clicking on the elements in the data pane on the left side of the Report Designer invokes popup menus. The popup menu for top-level entries allows access for defining calculated fields, parameters, groups, etc., while the popup menu for lower-level elements allows you to view the properties of individual data elements.

Formulas, Fixed Text, Hyperlinks and Images can also be added to the report layout. Fixed text can simply be typed into a cell in the layout. The other elements can be added by right clicking on the desired cell to invoke a popup menu from which to select the desired option.

## System Values

System values are values generated by the Report Writer engine at the time a report is generated and include such things as page numbers, date, time, etc.

For a list of System values, expand the System node in the data list to the left of the report layout:

System Value | Data Variable | Description
Page | _PAGE$ | Current page number
Date (Default) | _DateDefault$ | Current date in default format
Date (DD/MM/YY) | _DateDDMMYY$ | Current date in specified format
Date (MM/DD/YY) | _DateMMDDYY$ | Current date in specified format
Date (DD/MM/YYYY) | _DateDDMMYYYY$ | Current date in specified format
Date (MM/DD/YYYY) | _DateMMDDYYYY$ | Current date in specified format
Date (YYYY/MM/DD) | _DateYYYYMMDD$ | Current date in specified format
Date (MMM DD, YYYY) | _DateMMMDDYYYY$ | Current date in specified format
DayOfWeek (DDD) | _DayOfWeek$ | Abbreviated weekday name
Time | _Time$ | Current time HH:MM am
Time24 | _Time24$ | 24-hour time HH:MM
UserName | _UserName$ | UID
NetworkNode | _NetworkNode$ | NID
MachineName | _MachineName$ | FID(0)
Calculation Error Flag | _CalcErrorFlag | Boolean value indicating that an error has occurred when evaluating a calculated field
Static Filter | _StaticFilter$ | Description of the static filters that have been defined for the report (does not indicate case sensitivity) (The Static Filter system value was added in PxPlus 2022.)
Dynamic Filter | _DynamicFilter$ | Description of the dynamic filters for the report (does not indicate case sensitivity) (The Dynamic Filter system value was added in PxPlus 2022.)

The date and time variables also have associated unformatted variables that begin with '_s', such as _sDateDDMMYY$, _sDateYYYYMMDD$, etc. While the output for _DateYYYYMMDD$ might be '2020/02/25', the output for _sDateYYYYMMDD$ would be '20200225'. The unformatted date and time variables are used when building Destination Path Expressions.

(Support for Destination Path Expressions was added in PxPlus 2022.)

Besides these standard system values, additional user-defined values may be included using methods provided by the Logic Object Interface.

## Input Source Elements

These are the items or fields that make up the input source table. They are loaded into the item list when the input source is selected and appear under the input source's name. See Input Source.

## Related Data Source Elements

If the user has selected any related data sources, they will be listed in the item list along with their elements. See Related Data Sources.

## Calculated Fields

If the user has defined any calculated fields, these will be listed in the item list. See Calculated Fields.

## Parameters

If the user has defined run-time parameters, these will be listed in the item list. See Parameters.

## Group Functions

If the user has defined group functions, these will be listed in the item list. See Group Functions.

Since they contain summary information, group functions may not be placed in header sections of the layout. When dropped into a group section of the layout, the resulting data variable will automatically apply to that group level.

## Formulas

To add a formula, highlight a cell then select Formula from the Format menu or from the right-click popup menu. Two types of formulas may be defined: numeric calculations and text manipulation. In both cases, the formula may be entered as a free-form PxPlus expression.

To aid in the construction of an expression, select the Build button to generate the expression using a user-friendly interface. A maximum length and the display format mask for the resulting value of the formula must be defined. Default format masks are generated based on the length; however, you can select the Define button to define an alternative mask. Formulas may also be altered by selecting a cell containing a data element.

Formulas cannot be used in group functions, custom sort definitions or other formula definitions and have limited use in filter conditions. In addition, calculation errors cannot be trapped. Use calculated fields to overcome these possible shortcomings. See Calculated Fields.

## Fixed Text

Fixed text can be added by simply typing it in a cell. It has no format mask or tick mark and will appear verbatim in the report.

## Hyperlinks

Hyperlinks may be included as part of reports generated with HTML and PDF output. A hyperlink is associated with a report cell. The hyperlink definition consists of a URL reference (fixed or expression) and an option to open the hyperlink in the same browser window or a new one. The report cell value will be displayed as the descriptive text for the link in the report unless an image is assigned to the cell, in which case the image will serve as the link trigger. If an expression is used for the hyperlink, which evaluates to null when the report is generated, then the HTML output will display only the descriptive text or image and not create an active hyperlink. Reports destined for non-HTML output or PDF output (i.e. printer, PxPlus Report Viewer or Clipboard) will simply display the cell value.

A cell with a hyperlink must first be assigned a value (text, data source value or formula) to be displayed as the text for the link. The hyperlink can then be added by selecting Hyperlink from the Format menu or from the right-click popup menu. The Add a Hyperlink window displays.

The HTML Hyperlink input field can contain a literal link or a PxPlus expression if the Expression check box is selected. The drop box is pre-loaded with the names of the data source fields and report parameters. An option to Open link in a new browser window is also available for HTML output only. By default, the link will open in the current browser window.

(The ability to add hyperlinks to PDF output was added in PxPlus 2018.)

## Images

Images may be included as part of generated reports. They may be associated with a report cell, consisting of internal images, bitmaps or any image type included with the PxPlus feature Multiple Image Type Support. If images are not available at run time, cell contents will be displayed in their place. While images are fully supported on Windows/WindX systems, under UNIX/Linux, they require use of the *PDF* channel (.jpg only).

#### Note:
HTML will not support internal bitmaps (e.g. !File), and reports sent to the Clipboard will not contain images, but will contain the alternate text associated with an image.

To add/update an image, select Image from the Format menu or from the right-click popup menu.

The Image Path can contain the path to the image, an internal bitmap reference (e.g. !File) or a PxPlus expression if the Expression check box is selected. The drop box is pre-loaded with the names of the data source fields and report parameters.

Image paths must be defined in such a way that they are available at run time on the machine on which they are rendered. For example, when generating reports in a WindX environment, reports generated to the PxPlus Viewer (*VIEWER*) are rendered on the client, so the images must reside locally.

The following table shows the location of the images for the more common output destinations on WindX-based systems:

Destination | Special File Name | Image Location
Print Preview | *VIEWER* | Client
PDF Generator | *PDF* | Server
[WDX]*PDF* | Client |
Windows Printer | *WINPRT* | Windows Host (server), UNIX/Linux Host (client)
[WDX]*WINPRT* | Windows Host (server), UNIX/Linux Host (N/A) |
HTML File | FileName.htm | Server

The Report Writer Designer renders reports to the above destinations locally.

#### Note:
Image paths that make use of the special *BMP directory (e.g.*bmp/image.jpg) cannot be resolved in HTML output.

The following Display Option drop box selections are provided:

> Resize to fit region

> Resize with same aspect ratio, align top left

> Resize with same aspect ratio, centre in region

> Original size, align top left

> Original size, centre in region

#### Note:
The actual size of an image displayed using one of the Original size options is dependent on the resolution of the output device; e.g. an image displayed to the monitor using the PxPlus Viewer will appear much larger than the same image output to a high resolution printer. One of the Resize options is recommended to maintain consistency across different types of output.

If the cell contains a value (text, data source value or formula) as well, this value will only be displayed if the image is not available at run time. If both an image and a hyperlink are defined for the same cell, the image will be used to trigger the hyperlink in HTML output.