Ph: 800-848-2576
Fax: 360-654-8170
Contact Us
Printing multiple records on one line
This example will demonstrate how to print eight UNIQUE ORDER-NO's across a page grouped by the customer who placed those orders.  This example uses Remainder Logic as well as Array Variables. The scenario is as follows:

I need a report by customer that lists all of the orders the customer has placed during the specified time frame.  I would like to print the Customer Name and Number on a Begin Sort line, and then list his order numbers horizontally across the page.  I know that eight order numbers will fit across a page but I never know how many ORDER-NO's a customer may have.

These are the steps involved:

Open a new REPORT.

From the Topic window choose ORDERS as your primary topic.

Open the Report VARIABLES window and add these 4 variables:

 NAME

 TYPE

 LENGTH

 DIMENSION

 CNT

 NUMERIC

 8

 1

 RMDR

 NUMERIC

 8

 1

 IDX

 INTEGER

 2

 1

 ORD-ARRY

 NUMERIC

 6

 8


Close the Variables window.

Open the Report Sort window and shoot in CUST-NO as your highest sort and ORDER-NO as your lowest.

Close the Sort window.

Open the Report COMPUTATIONS window and add the following variable definitions:

 LEVEL

 NAME

 EXPRESSION

 IF CONDITION

 Begin Sort
 CUST-NO

 CNT

 0

 

 Detail

 CNT

 CNT + 1

 

 Detail

 RMDR

 CNT - (CNT / 8 * 8)

 

 Detail

 IDX

 RMDR

 

 Detail

 IDX

 8

 RMDR = 0

 Detail

 ORD-ARRY(@)

 "  "

 IDX = 1

 Detail

 ORD-ARRY(IDX)

 BASEA.ORDERS.ORDER-NO

 



On the DETAIL level of the report shoot all occurrences of the variable
ORD-ARRY.

In the PRINT IF box of the DETAIL LEVEL LINE ATTRIBUTES window type:

RMDR = 0

(zero)

Insert an END OF SORT GROUP CUST-NO level and shoot all occurrences of the variable ORD-ARRY onto the new level.

With your cursor on the END OF SORT GROUP CUST-NO Level click on the Report/Line Attributes.

In the PRINT IF box type:

RMDR <> 0

(zero)

Delete the last ORD-ARRY from the END OF SORT GROUP CUST-NO level, ORD-ARRY(8) in this example. For each of the 7 remaining ORD-ARRY variables, in the PRINT IF box of the FIELD ATTRIBUTES window type:


Where "#" refers to the corresponding element number.  i.e., ORD-ARRY(1)

Anywhere the number 8 appears above, refers to the number of ORDER-NO's to print per line.


Download MULTIORD.CTW - A Visimage Context that illustrates this tip.
Send questions & comments regarding the Vital Soft site to:  webmaster@vital-soft.com
Copyright © 1998-2012, Vital Soft, Inc.