Top Ten Style Reports
Reports offer you the ability to create fully functional Top-ten style lists which will restrict the output to a pre-specified number of records and sort by your Sequence field. This is perfect for creating simple reports where you only wish to show a certain set of records, for instance — the top highest sales regions. While you can create a "Top 10" list for the detail level, this document will illustrate the process for creating a "Top 10" based upon a Sub-total Level.
Let's say you are interested in seeing the top highest values based on a particular subtotal level. Or, perhaps, you are interested in utilizing one report to see both the top 10 and the lowest 10. You could create two separate applications, or you could use Method 2 — Top-10 Lists for a Subtotal Level.
Step 1: Build your application as you normally would — be sure, however to sequence on the field you wish to "group" your top 10 list. In this example, we will be "grouping by" product number. Note: Since we are grouping by Product Number, be sure Subtotal is set to "Yes".
Be sure to specify the Report Template. In addition, be sure the "Summary or Detail" report is set to "Summary". This will allow our page to print without showing the detail line by default.
Build your application. Now, through the URL line, we can actually specify all of our parameters at run time.
For instance, our initial screen would look something like this:
Rather than clicking submit, we can modify the URL from looking like this:
DD.R00010s
To
DD.R00010s?run=2&cur_sort_col=PYDOL&sort_typ=1&top10=10
Doing so would result in a screen that looked like this:
Let's go through the syntax of the URL:
DD.R00010s?run=2&cur_sort_col=PYDOL&sort_typ=1&top10=10
DD — Data Dictionary
R00010s — Application Number
run=2 — This specifies to the servlet that you intend to skip the prompt page, and go directly to the output page. Note: You can utilize Run=1 to further specify the report (Output format, levels of data included). Click here to find out how.
cur_sort_col — This parameter controls what field you wish to sort your top ten list. In our case, sorting by Last Years Sales sorts by the products that earned the most money.
sort_type — This parameter controls whether you want your list in ascending or descending order. A "1" specifies a descending list where a "0" specifies an ascending list.
top10 — This parameter controls how many records you wish to have in your top ten list.
As you can see, it is very easy to build many ad hoc reports simply based off of one m-Power generate report.
Using the same application, lets change the parameters so you can see how flexible this feature is:
Our new URL:
DD.R00010s?run=2&cur_sort_col=PRDNO&sort_typ=0&top10=20
This time sort by the Product Number, in ascending order and return back 20 records. The screen shot for this screen is below: