Exercise 6:Defining the Linesets [ HP ALLBASE/BRW Tutorial ] MPE/iX 5.0 Documentation
HP ALLBASE/BRW Tutorial
Exercise 6:Defining the Linesets
You define the linesets for the report in this section. The report uses
multiple break level, layout calculated items, and suppresses certain
lines. You will learn about the ColCalc (column calculation) field logic
and how to specify source and reset levels for ColCalc. This exercise
takes 45 minutes.
Look at the sketch again to see the linesets you need.
The report has seven linesets. If you need to review the linesets for
this report in more depth, see the "Linesets for this Report" section,
earlier in this chapter.
The Page Heading Lineset
Define the page heading lineset
1. Choose Define Lines from the Define Breaks screen.
2. At the (D,P,R,1..9) prompt, type P (for page).
3. At the (H,F) prompt, type H (for heading).
4. Press Enter.
5. Look at the upper part of the Define Lines Page Heading screen.
The screen contains the page heading information you used for the
first report in Lesson 2.
6. Change the report heading to read as follows:
Customer Details Report: 2
The screen should now look like this:
NOTE Did you remember how to get to the text in the upper part of the
screen? Type the line number in the first small field in the lower
part of the screen and type (or modify) the text shown in the
longer field. When you press Enter, the text showing in the upper
field reflects the changes.
If you want more details about how to use this screen, refer to the
"Page Heading Lineset" section of Chapter 3.
The Level 1 Break Heading Lineset
Define the level 1 break heading
1. Choose Select Lineset
(If Select Lineset does not appear on your function labels,
choose other keys until it does. )
2. At the prompt, type 1 for the level 1 break and H for heading.
3. Press Enter.
The Define Lines screen appears.
The screen shows the heading for break level 1 on SALES-AREA for
the first report.
For the CUSTREP2 report you only need the new sales area in this
break heading. You are going to put the customer information in
the break level 2 heading. So, you can delete lines 4, 5, and 6
as described in the next steps.
4. Choose other keys until you see Delete Lines. Then choose
Delete Lines.
5. At the prompt, type 4/6.
6. Press Enter.
The final heading looks like this:
The Level 2 Break Heading Lineset
Define the level 2 break heading
1. Choose Select Lineset.
2. At the prompt, type 2 and H in the fields of the prompt.
3. Press Enter.
This is the Define Lines screen for the break level 2 heading on
CUSTOMER-NO.
This screen contains blank fields because no break level 2 was
defined for the previous report.
4. Look at the rough sketch again. The heading for the break on
CUSTOMER-NO must print the name and number for the new customer as
well as a heading for the details of each order.
5. Add the new text and fields for this break level. If you need to
review the steps, look at examples from Lesson 2.
The screen will look like this:
NOTE If you had put this heading in the detail lineset, a heading would
be printed above every detail. You don't need that many headings.
You only want the heading once at the beginning of each set of
customers in a sales area.
Substituting a line.
Look at the sketch. It shows a special line that is printed when a
customer has no orders.
Define a "substitute" line
1. Type 6 in the line number field.
2. Type this line in the next field.
********************NO ORDERS FOR THIS CUSTOMER********************
(There are 20 asterisks on each side of the text. Don't waste a
lot of time counting them--it's only for emphasis.)
3. Choose Insert Line.
(DON'T press Enter, since that would overwrite the blank line 6.
you want to keep that blank line.)
The new line is inserted before line 6. The lines after the new line are
renumbered.
Your screen should now look like this:
Suppressing lines.
You don't always want to print the NO ORDERS... line. When you do have
a customer with no orders, you don't want to print the introduction lines
(the column headings) for the details.
Suppress unneeded lines
1. Choose Suppress Line. (Use other keys if you need to bring up
more function labels.)
2. At the Suppress condition for line prompt, type 4 to suppress line
4 (the headings for the details).
3. Press Enter.
The Suppress Line screen appears.
This screen is similar to the Suppress Lineset screen.
4. Type this text in the blank area provided:
ORDER-NO = NO_VALUE
<< Suppress this line, which introduces the detail lines,
if the customer has no orders. >>
5. Press Enter.
The prompt tells you that the Suppress Line condition was added.
6. Choose Next Line.
The screen typing area of the screen appears blank. The left side
of the screen heading shows that you are suppressing line 5.
7. Type the same suppress condition for line 5.
ORDER-NO = NO_VALUE
<< Suppress this line, which introduces the detail lines,
if the customer has no orders. >>
8. Press Enter.
Lines 4 and 5 will now be suppressed (not printed) when ORDER-NO
equals NO_VALUE (no order number was found in that detail line
meaning that there are no orders for that customer).
9. Choose Next Line to display the screen for line 6.
10. Type this suppress condition for line 6.
NOT (ORDER-NO = NO_VALUE)
<< Suppress this line, which warns if a customer has NO orders, if
the customer has an order. >>
11. Press Enter.
The line condition is added. When there is one or more orders for
a customer, the warning line will not be printed.
12. Choose Exit to return to the Define Lines screen.
The Detail Lineset
You already have the column headings for the detail lines. Now you add
the detail lines to the report.
Define the detail lineset
1. Choose Select Lineset.
2. At the prompt type D (leave the H,F prompt blank).
3. Press Enter.
4. The Define Lines screen for the detail lineset appears.
The old line from the previous report is there. Your new report
is just one line and should contain the order number, product
number, price, quantity ordered, and the total for the order.
The old line doesn't match what you need for the new report.
5. Delete the old line.
(Use other keys to get to the Delete Lines function label. Type
the line number at the prompt.)
The prompt warns you No line defined.
The items are still listed in the lower part of the screen. You
don't need them either.
6. Press Clear Display or clear the items by spacing over them.
7. Press Enter.
Copying lines.
The items on the Detail line must line up with the headings that you have
already defined on the level 2 break heading lineset (for the break on
CUSTOMER-NO). You can ensure that the lines are correctly aligned by
temporarily copying the lines from the level 1 lineset and using it as a
template.
Copy lines from another lineset
1. Choose Copy Lines.
2. At the Copy prompt, type 4, the number of the line that you want
to copy.
3. At the next part of the prompt, from lineset level, type 2, the
number of the lineset level you want to copy from.
4. At the next part, type put H for heading.
5. Type 1 for the to line prompt.
6. Press Enter.
BRW copies the line.
Now you can see how to align the items so they match the headings.
Adding the items
1. Type the infomation for the items ORDER-NO, PRODUCT-NO, PRICE, and
QUANTITY in the lower part of the screen. Use the following
figure as a guide.
Your screen should show the same Pos for the items as is shown on
this screen:
2. Press Enter to have the items appear in the upper part of the
screen. The fields for Type and Length are automatically filled
in by BRW.
Using Layout Calculated Items.
The total for orders is not part of the data set. BRW must calculate
this total for the report. You define a formula for the calculation and
BRW performs the calculation whenever a line is printed that contains the
calculated item.
In this report, the calulation must multiply the quantity ordered by the
price of the product.
Create a Layout Calculated Item
1. Choose Layout Calcitem.
2. Type ORDER-TOTAL in the Item field.
3. Type N in the Result Type field.
4. Press Enter or choose Add Item.
The Layout Calc Item screen below shows you how the calculation is set
up.
Later you will learn to set the numeric precision of a result like this.
Define the formula
1. Choose Define Formula.
The Layout Calc Item Formula screen appears. The blank area is
where you type the formula.
As with all formulas in BRW, you can use up to two screens. You
can call user-defined functions, standard functions, or other
calculated items. The formula cannot call itself (this is
recursion and is not allowed in BRW).
2. Type the formula:
PRICE * QUANTITY
<< This item finds the total value of an order by multiplying
the price of the product by the quantity ordered. >>
3. Press Enter.
4. Press Exit twice to return to the Define Lines screen.
5. Type the name of the calculated item, ORDER-TOTAL, in the Item
field below the item QUANTITY.
6. Type 47 for the Pos (position) field and 2 for the line.
7. Press Enter.
Your screen will now look like this:
You can see that each item is correctly aligned beneath the appropriate
heading. (If they aren't correct, take some time to correct them now.
You can alter the Len field to change the field length or change the Pos
field to correct an alignment.)
When you are finished, you don't need the temporary heading line (line 1)
anymore.
Delete the temporary heading
1. Choose Delete Lines.
2. At the prompt, type 1 for the line number you want to delete.
The temporary line is removed and the items are correctly aligned in the
detail lineset.
The Level 2 Break Footing Lineset
Define the level 2 break footing
1. Choose Select Lineset.
2. Select the level 2 lineset for the break footing by typing 2 and F
at the prompt.
The Define Lines screen for the break level 2 footing
(CUSTOMER-NO) appears. Since there wasn't a break level 2 in the
first report, nothing is defined for this break level footing yet.
3. Define the footing so that it prints the total sales for each
customer. All the total lines must line up (start at the same
character position).
Use what you learned about Copy Lines from the previous section
to copy line 2 from the report footing lineset to line 1 of this
lineset. The copied line will help you to see where the total
sales for the customer must be printed and make sure the detail
lines match the headings.
When you finished the screen should look like this:
4. Type 1 in the line number field.
5. Start at character position 1 in the text field and type:
Sales for Customer:
6. Space over the other characters in the text field up to, but not
including the text is:
7. Press Enter.
The item field for the total will still appear on the layout.
8. Type CUSTOMER-NAME in the Item field below TURNOVER-MTD, put it in
character position 21 on line 1.
9. Press Enter.
Add a blank line above line 1
1. Type 1 in the line number field.
2. Space over the text (or use Clear Line in the text field.
3. Choose Insert Line.
Line 1 becomes line 2. The new line 1 is a blank line.
4. Create line 3 and use it for the underline under the total.
5. Create a blank line for line 4.
6. Space over the word TOTAL in the ColCalc field.
You want the actual turnover amount, not the total.
7. Press Enter.
Your screen should look like this next example.
The Level 1 Break Footing Lineset
Define the level 1 break footing
1. Choose Select Lineset and specify lineset level 1, type F.
The screen shows the footing for break level 1 on SALES-AREA from
the previous report. You can use much of this lineset that you
copied from the first report.
2. Look at your sketch for this report. The new lineset for the
break on sales area is identical to the old one, except for some
new underlining.
3. Change the word TOTAL in the ColCalc column for TURNOVER-MTD to
TOTAL 1,2 .
4. Press Enter.
The break footing lineset is complete. The screen looks like this:
NOTE In your first report, using the column calculation of TOTAL, BRW
printed a running total for that item. Each time a detail line is
written, the value for that item is added to the running total.
With BRW, the default source level is the detail line.
With the column calculation of TOTAL for TURNOVER-MTD on the
SALES-AREA break, the total is reset to 0 after each break on a new
sales area. If you use TOTAL for TURNOVER-MTD on the Report
Footing, the total is not reset to 0 until it reaches the break on
the report footing (the end of the report). With BRW, the default
reset level is the lineset in which the item occurs.
The defaults for the TOTAL calculation are entered as 1 (reset on
the lineset level where the item occurs) and 1 (use the detail line
as the source level).
For the current report, you want the value to be reset every time
the SALES-AREA changes (lineset level 1). But you do not want the
value from each detail line, just the value for each customer. You
get this value from the line printed when the CUSTOMER-NO changes
on the level 2 break for CUSTOMER-NO. So, you define TOTAL as TOTAL
1,2.
(TURNOVER-MTD is defined once per customer, not once per order.)
A more complete description of the ColCalc entries is found in the HP
ALLBASE/BRW Reference Manual.
The Report Footing Lineset
This is the final lineset for this report.
Define the report footing
1. Choose Select Lineset for a report footing (R and F).
The rough sketch shows that the report footing will print the
total sales for all sales areas.
2. Add two lines to emphasize the total. Create a line with double
underlining (using equal signs) above the current total line and a
line with double underlining under the current total.
The screen will look like this:
3. Adjust the TOTAL in the ColCalc field for TURNOVER-MTD to reset on
the report break level (R) and take values from the break on
CUSTOMER-NO (level 2).
The final report footing should look like this:
MPE/iX 5.0 Documentation