Previous | Contents | Index |
For each item, you can use one or more of the following print options:
HEADING 'column_heading'
LENGTH column_length
MASK 'edit_mask'
POSITION column_position
[WITH] TOTALS [= total_expression]
GROUP break_level
6.20.1.1 HEADING
One to three HEADING lines are permitted. A comma
causes the heading to be printed on the next line. If no heading is
specified, GQL uses the heading that is stored in the field definition
file.
HEADING 'hdg1, hdg2, hdg3'
Example:
PRINT employee(last) HEADING 'Employee,Last,Name' |
This example will produce a column heading that looks like this:
Employee Last Name ------------------- XXXXXXXXXXXXXXXXXXX |
Specifying the column LENGTH (number of characters in
the column) overrides the default column length. This option can be
used to shorten (or lengthen) the column.
LENGTH nn
Example:
PRINT customer(name) LENGTH 12 |
MASK permits you to override the default edit mask. The default mask is the one stored in the field definition file. You might want to specify your own mask in columns where calculations are performed or totals are specified.
For further description of edit masks, refer to the "PRINT USING"
section of the INTOUCH, A Guide to the Language manual.
MASK '###,###'
Example:
PRINT invoice(qty) * invoice(unitprice) MASK '$##,###.##' |
The POSITION option specifies the absolute printing position to start the column. If the column specified is less than or equal to the last position of the last specified column, the column will be placed at that position on the NEXT line down. If any part of the column underlies another column, the heading for the new column will be suppressed.
The following example could be used for printing a mailing-label
format. Position 1 is the far-left side of the screen; position 80
(normal screen) or 132 (wide screen) is the far-right side.
POSITION nn
Example:
PRINT customer(name) PRINT customer(address) POSITION 1 PRINT customer(city) POSITION 1 PRINT customer(state) PRINT customer(zip) |
POSITION +nn specifies a relative printing position from the first available space after the last specified column. For example, POSITION +3 will leave 3 blank spaces before this column, and POSITION +0 will leave no blank spaces between this column and the last one.
Example:
PRINT customer(name) PRINT customer(address) POSITION +3 PRINT customer(city) POSITION +3 |
POSITION = is used to print this column directly beneath the last column. In the following example, customer(address) and customer(city) are printed underneath customer(name).
Example:
PRINT customer(custnbr) PRINT customer(name) PRINT customer(address) POSITION = PRINT customer(city) POSITION = PRINT customer(state) PRINT customer(zip) |
POSITION = nn will print this column beneath column number nn. Columns are counted in the order they are listed. In the following example, customer(address) will print underneath customer(name).
Example:
PRINT customer(custnbr) PRINT customer(name) PRINT customer(balance) PRINT customer(days_past_due) PRINT customer(address) POSITION = 2 |
TOTALS specifies that this column will be totaled.
Subtotals will be printed at level breaks and grand totals will be
printed at the end of the report. The word WITH is
optional.
PRINT [WITH] TOTALS [= total_expression]
Examples:
PRINT detail(qty) with totals PRINT price / qty with totals = total price / total qty & heading 'Average,Unit,Price' mask '###,###.##' |
The GROUP option groups records together. Where the data in a column is identical within a given break level, only the first occurrence is printed. You can specify the break level, GROUP nn, that the grouping is associated with. If the group number is not specified, the grouping is associated with break level 1.
Example 6-23 Example of PRINT Command with GROUP Option |
---|
OPEN DETAIL SORT BY PRODNBR SORT BY LINEID INCLUDE INVNBR = 10301 TO 10302 INCLUDE PRODNBR = 22800 TO 31150 BREAK ON PRODNBR PRINT PRODNBR GROUP 1 PRINT LINEID PRINT QTY PRINT PRICE PRINT EXTPRICE WITH TOTALS GO |
Example 6-24 Example of PRINT Command with GROUP Option - Output |
---|
22-Jan-1999 Report on DETAIL Page 1 Line Prod Item Order Selling Extended Nbr ID# Qty Price Price ----- --------- ------ ---------- ---------- 22800 10301-002 2 375.00 750.00 10301-004 1 375.00 375.00 10301-006 2 375.00 750.00 ========== 1,875.00 24200 10301-003 1 299.00 299.00 ========== 299.00 28400 10302-001 3 149.00 447.00 ========== 447.00 28800 10301-009 2 249.00 498.00 ========== 498.00 31020 10301-005 1 595.00 595.00 ========== 595.00 31150 10301-001 1 2,495.00 2,495.00 10301-008 8 2,495.00 19,960.00 ========== 22,455.00 ========== 26,169.00 |
The following is another example using the PRINT GROUP option.
OPEN DETAIL OPEN INVOICE OPEN CUSTOMER OPEN PRODUCT RELATE DETAIL(INVNBR) TO INVOICE(INVNBR) RELATE CUSTNBR TO CUSTOMER(CUSTNBR) RELATE PRODNBR TO PRODUCT(PRODNBR) TITLE 'INVOICES' SORT BY LINEID BREAK ON INVNBR PRINT INVNBR GROUP 1 PRINT DATE GROUP 1 PRINT CUSTOMER(NAME) GROUP 1 PRINT INVAMT POSITION 48 GROUP 1 PRINT ' ' POSITION 5 GROUP 1 PRINT ITEMNBR POSITION 5 PRINT DETAIL(QTY) PRINT PRODNBR PRINT PRODUCT(DESC) PRINT PRICE PRINT EXTPRICE GO |
22-Jan-1999 INVOICES Page 1 Inv Invoice Invoice Extended Nbr Date Customer name Amount Price ----- -------- ------------------------- ---------- ---------- 10301 19980101 Anywhere Travel Service 28,712.00 1 1 31150 150MB disk drive 2,495.00 2,495.00 2 2 22800 EZVue-800 CRT terminal 375.00 750.00 3 1 24200 ZX-LQ printer 299.00 299.00 4 1 22800 EZVue-800 CRT terminal 375.00 375.00 5 1 31020 20MB disk drive 595.00 595.00 6 2 22800 EZVue-800 CRT terminal 375.00 750.00 7 2 33090 90MB streaming tape drive 1,495.00 2,990.00 8 8 31150 150MB disk drive 2,495.00 19,960.00 9 2 28800 800KB floppy disk drive 249.00 498.00 10302 19980101 PacWest Corp 447.00 1 3 28400 400KB floppy disk drive 149.00 447.00 10303 19980101 Anywhere Travel Service 3,982.00 1 1 33090 90MB streaming tape drive 1,495.00 1,495.00 2 3 24200 ZX-LQ printer 299.00 897.00 3 2 31030 30MB disk drive 795.00 1,590.00 |
The following example shows 2 level breaks.
OPEN DETAIL OPEN INVOICE OPEN CUSTOMER OPEN PRODUCT RELATE DETAIL(INVNBR) TO INVOICE(INVNBR) RELATE CUSTNBR TO CUSTOMER(CUSTNBR) RELATE PRODNBR TO PRODUCT(PRODNBR) SORT ON PRODNBR SORT ON CUSTOMER(NAME) SORT ON DATE BREAK ON PRODNBR BREAK ON NAME PRINT PRODNBR GROUP 1 PRINT DESC GROUP 1 LENGTH 18 PRINT NAME GROUP 2 LENGTH 18 PRINT LINEID PRINT QTY PRINT PRICE GO |
22-Jan-1999 Report on DETAIL Page 1 Line Prod Item Order Selling Nbr Product Descriptio Customer name ID# Qty Price ----- ------------------ ------------------ --------- ------ ---------- 20120 Bananna PC Jr Alpha Products Inc 10376-003 7 1,495.00 10394-002 3 1,495.00 Anywhere Travel Se 10340-004 1 1,495.00 10340-008 2 1,495.00 10400-004 1 1,495.00 . . . Tumbleweeds Real E 10393-006 2 1,495.00 22600 EZVue-600 CRT term Alpha Products Inc 10314-002 1 325.00 Anywhere Travel Se 10348-003 3 325.00 10400-003 1 325.00 |
PROGRAM program_name [UNIQUE] |
Previous | Next | Contents | Index |