Generating and printing a sequence number for your print lines
As a "stand-alone"
feature, this is not a common requirement, but it does arise. More
importantly, generating a number for each successive detail print
line on the page has application as a component in building such
reports as "Top-10-Ranking" reports.
In our next feature, we will be
showing you how to build a "Top-10-Ranking" report. The
ability to generate a number for your detail print lines will be
"assumed knowledge" in that article.
Before we start, it is important
to be sure that you understand what a "data-group" is in
the context of the report writer. If you are quite sure that you
do, read on. If not, perhaps you have heard the term but are not
quite sure what it means - maybe you've never heard it, for an explanation of Data Groups click
here - it will make it
easier to understand the following explanation.
The report writer does not
"count" print lines as such. However, you can build a
counter over one or more particular fields and print this on your
report layout. For this example, we're using the training Subset
supplied as part of all report writer installations - "DEMOINVENT".
For more about the DEMOINVENT Data Group structure click
here
Our example report is going to
print the products, and their stock values, within each warehouse.
We will number each warehouse in the report and, within each
warehouse, each product will be numbered. So, let's get
started.
Start the Jacana new report wizard
and choose DEMOINVENT as your data source. Add the fields:
"Warehouse Identifier" (WHID), "Product Number"(PRON) and
"Extended Selling Price" (EXSP) to your working list.
In the wizard sort dialog, choose
"Warehouse Identifier" and then "Product
Number" for your sorting and then click on
"Finish". Jacana will design the report and show you the
layout. We are now ready to define the counters that will enable
us to print sequence numbers for each Warehouse and each
Product.
Open the report specifications
dialog and add a new calculation (with Properties of Signed
Numeric 3,0 with text "Warehouse Rank"). Condition the
calculation WHY?
as follows:
*IF &WHID = ' '. Click OK then
set the expression to 1. Now click on the "else" case,
and set the expression there to 1 also. Now, you have a
calculation that will hold the value 1 in all circumstances (i.e.
when the Warehouse Identifier is blank and also when it is not). A
Running total of this calculation field will give us the sequence
we want to see on the report.
Now create a second calculation,
like the first, but testing "Product Number" in the
condition (instead of Warehouse Identifier). Set the text to,
"Product Rank".
Now, via the Report Specifications
dialog and the 'Summarize' tab, specify a "Running
Total" for both these calculations then click on the
"Summary Fields" button on the Data Crafter tool bar.
You will see 6 running totals defined - one for each calculation
at each sort level ("Report Level", "Change of
Warehouse" and "Change of Product").
Drag, "Running total of
Warehouse Rank for Report" and drop it beside the Warehouse
Identifier field on the print line (Tip: Use the right-mouse to
drop both the field and its column headings). Next, drag the,
"Running total of Product Rank by Warehouse ID" WHY?
and drop it beside the Product Number. Finally, use the
"Format field" dialog to format the "Running total
of Product Rank by Warehouse ID" to "Always Print" WHY?. Save and run this report and view the output.
Note the sequence numbering beside
warehouse and product.
NB: Dependent on the preferences
you have set in Jacana your field names may appear differently in
the Data Crafter. The field name WHID for Warehouse Identifier for
example may appear as t00.FACIDN
Do you have any specific questions
you'd like answered? Let us know momentum@jacana.com
|