In this example we will use the
Link
on the Fly syntax. We will choose ORDERS as our PRIMARY dataset
and then write a link back into the same dataset to accomplish a report
that otherwise would have taken two passes.
The scenario is as follows:
I am the marketing manager of the Brand-X store. Our store had
a sale January 8, 1994. I need a report that will show only those
customers who placed orders during our sale. I would also like
to see what products those customers purchased from us last year.
These are the steps involved:
Open a new List or Report.
Choose
ORDERS as the Primary Topic.
Open the Selection window.
Click on the
Variables button.
Type
LINK1 in the Name box, change the type to Numeric Length of
1.
Place your cursor in the Initial Value box and type:
0);
LINK LINK1, BASEA.ORDERS.CUST-NO :: BASEA.ORDERS.CUST-NO;*
Click
Close when
finished.
Click on the
Options button.
Place your cursor in the Output select file definition box and type:
LINK1..ORDERS
Click
OK when finished.
In the Selection criteria window type:
BASEA.ORDERS.ORDER-DATE = "940108" AND
LINK1..ORDERS.ORDER-DATE IB "930101","931231"
The report layout is up to you.
This scenario works best if only one record per CUST-NO is found in the initial set of values before linking back into the Primary dataset.