constructreport
constructreport
TEMPLATE

The constructreport statement creates a report in the current form.

Parameters

This statement has one parameter:

template – dictionary that contains options for constructing a report (see discussion below).

Description

This statement creates a report layout in the current form using Report Tile objects.

For example, if your database contains the fields Quantity, Item and Price, this example will generate report tiles laid out to print those fields in three columns.

    constructreport
        |||Quantity<width:7c><align:center>
        Item<width:25c><search>
        Price<width:10c><align:right>|||

You can use the generated layout as is, or you can manually modify it further with Panorama’s graphic tools to customize it for your needs.

There are about a dozen options you can specify in the dictionary, each of which is described below.

#### Column Specifications

To specify a report with multiple columns, list each column name on a separate line. Here is an example for a list with three columns.

    Quantity
    Item
    Price

If the column name is the same as a field in the database, the column will have the same width and alignment as that field. If the column name is not a field name, a default width will be used. You can override the width and alignment with the `<width:dimension>` and `<align:option>` tags.

    Quantity<width:75><align:center>
    Item<width:250>
    Price<width:100><align:right>

Normally the width is expressed in points (one point is 1/72nd of an inch). By adding a c prefix to the dimension, you can specify the width in characters. Since different characters have different widths (a W is wider than an I, for example), this is an approximate measurement. Depending on what characters are being displayed, you might be able to display more or less than the exact number of characters specified. In this example the three columns have widths of 7 characters, 25 characters, and 10 characters.

    Quantity<width:7c><align:center>
    Item<width:25c>
    Price<width:10c><align:right>

The nice thing about specifying widths in “characters” is that the widths will automatically adjust if you change the font size of the text. You may have to fiddle a bit to get something that works well at all the text sizes you want to use, but it is usually possible.

#### Column Formula and Title

You can also specify a formula for the column. If you do that, you will usually want to specify a column title with the `<title:name>` tag, as shown in this example. (If you don’t specify a title, the formula will be used as the title.) In this example four columns of data will be printed with these titles: Quantity, Item, Price and Discount.

    Quantity
    upper(Item)<title:Item>
    Price
    pattern(ListPrice-Price,"$#.,##")<title:Discount>

#### General Vs. Column Options

So far we’ve talked about columns and column related options. These are specified one per line, starting with the name or formula, then with one or more options, like this.

    column<column option>
    column<column option><column option>
    column<column option>
    column<column option>

In addition to column options, you can also specify a number of general options. These should be specified on separate lines from the column specifications (however, you can have multiple general options on a single line).

    <generaloption>
    <generaloption><generaloption>
    <generaloption>
    <generaloption>
    column<column option>
    column<column option><column option>
    column<column option>
    column<column option>

The rest of this page describes the various general options that are available.

#### Data Truncation

If there is more data than will fit in a column, it is normally truncated, with an ellipsis on the end showing that there is additional data. You can use the `<linebreakmode:>` option to change this. The available options are `truncate tail` (the default), `truncate middle`, `truncate head` and `word wrap`.

#### Geometry

The options in this section allow you to change how generated objects are laid out. A number of the options below allow you to specify measurements values – height, width, etc. These values are normally expressed in points (1 point = 1/72 inch) but you can also specify values in inches (`1 in` or `2.5 inch` or `0.75"`) or centimeters (`20 cm`).

#### Report Width

The default width for the data area of the generated report is 576 points. This is 8 inches, which usually works well for printing a portrait report on 8 1/2“ by 11” paper (standard in the US). Use the `<width:measurement>` tag to specify a different width. This example creates an object that is 10.5 inches wide, useful for landscape printing.

    <width:10.5">

Keep in mind that to set the overall object width, the `<width>` tag must not be on the same line as a column specification. A `<width>` tag that is part of a column specification sets the width for that column of data, not the entire report width. This example shows the `<width>` tag being used both ways – the first line sets the width of the overall report, while the next three lines set the width of individual columns.

    <width:11">
    Quantity<width:75><align:center>
    Item<width:250>
    Price<width:100><align:right>

Keep in mind that the width is the width of the data area – it does not include the left and right margins.

#### Font and Size

You can change both the font and size of the generated text objects. Changing the size is more common, to do that use the `<size:points>` tag. Normally you would do this just once at the top. You can specify the size as regular (13 points), small (11 points) or mini (10 points).

    <size:small>

Or, you can also specify the exact size numerically.

    <size:18>

Use the `<font:name>` tag to change the font. If this tag is omitted, the system font will be used.

    <font:Tekton><size:regular>
    Quantity<width:75><align:center>
    Item<width:250>
    Price<width:100><align:right>

#### Row Height

The row height is normally set for you automatically, based on the font size (see above). However, you can also use the `<rowheight:dimension>` tag to directly set a specific height. The example below will create a “double spaced” report, with an extra 15 points below each line of data (of course this can be adjusted manually after the layout is generated).

    <size:15>
    <rowheight:30>
    Quantity<width:75><align:center>
    Item<width:250>
    Price<width:100><align:right>

Note that the rowheight tag must be specified after the size tag (if any). If the size tag is used after the rowheight tag, the size tag will override the rowheight tag.

#### Margins

The constructreport statement will automatically generate 1/2 inch top and bottom margins, and 1/3 inch left margin. If you want different margins, use the `<topmargin:dimension>`, `<bottommargin:dimension>' and`<leftmargin:dimension>` tags.

    <topmargin:5cm><bottommargin:3cm><leftmargin:1cm>
    Quantity<width:75><align:center>
    Item<width:250>
    Price<width:100><align:right>

### Data Column Titles

The constructreport statement will automatically generate a Data Header tile with titles for each column in the report. The field names will be used as the titles, unless you have explicitly set up titles with the `<title:name>` tag (see above). The titles will use the same font and size as the data, but you can customize the style and color.

To customize the style, use the `<titlestyle:style>` tag. The available options are bold, italic, bolditalic, underline, and boldunderline.

    <titlestyle:bold>
    Name
    Address
    City
    State
    Zip

Use the `<titlecolor:color>` tag to specify the color (the default is white). You can name the color (red, blue, etc) or use “html” style hex colors, for example `FF0000` for red.

    <titlestyle:bold><titlecolor:blue>
    Name
    Address
    City
    State
    Zip

You can also use the `<titlebackgroundcolor:color>` tag to specify a background color for the titles. This example will print white titles on a black background.

    <titlestyle:bold><titlecolor:white><titlebackgroundcolor:black>
    Name
    Address
    City
    State
    Zip

### Page Headers and Footers

Use these six tags to add text at the top and/or bottom of each page.

    <topleftheader:text>
    <topcenterheader:text>
    <toprightheader:text>
    <bottomleftfooter:text>
    <bottomcenterfooter:text>
    <bottomrightfooter:text>

To insert the page number into one of these header areas, simply type in `«page#»`. For example, this template will print the page number in the top right corner of every page:

    <toprightheader:«page#»>
    Name
    Address
    City
    State
    Zip

The date can also be inserted in a variety of different formats:

    «date: mm/dd/yy»
    «date: mm-dd-yy»
    «date: MM/DD/YY»
    «date: MM-DD-YY»
    «date: mm/dd/yyyy»
    «date: MM/DD/YYYY»
    «date: mm-dd-yyyy»
    «date: MM-DD-YYYY»
    «date: dd-MON-yy»
    «date: dd-Month-yy»
    «date: Month dd, yyyy»
    «date: Month ddnth, yyyy»
    «date: DayOfWeek, Month ddnth, yyyy»
    «date: DayOfWeek, Month dd»

You can also merge an entire formula into a header or footer using curly braces.

    <topleftheader:Printed by {info("user")}>
    <toprightheader:«page#» of {info("pagecount")}>
    Name
    Address
    City
    State
    Zip

The header and footer areas default to 2/3rd’s of an inch high (48 points). You can use the `<headerheight:dimension>` and `<footerheight:dimension>` tags to customize the height.

### Summary Tiles

If you would like a report with both data and summary tiles, use the `<summary:level>` tag. The level parameter tells how many summary level tiles should be created: 1, 2, 3, etc.

    <summary:2>
    Date
    Check
    PayTo
    Amount

See Also

- constructformdataeditors -- creates a column of form elements for editing data fields (or variables).
- constructlineitems -- creates a grid of line items.
- constructlistmatrix -- creates a text list or matrix in the current form.
- constructmailinglabel -- creates the form elements for printing mailing labels.
- constructtabpanel -- creates a tab panel in the current form.
- formconstructordialog -- opens a generic form constructor dialog.
- newsearchgadget -- creates a search gadget in the current form.

History

Version | Status | Notes
10.2 | Updated | Now defaults to truncation with ellipsis if a data is too long to fit in a column. This can be customized with the linebreakmode tag.
10.1 | New | New in this version.