| How-To Document
Customize Report Pagination
Date: 10-Nov-2003
Author: Marc Sewtz
Based on Oracle Application Express (formerly HTML DB) version 1.5
After completing this How-To, you should be able to understand:
- Using different report pagination styles
-
- Implementing custom pagination styles using report templates
-
Table of Contents:
Introduction
In Oracle HTML DB a report is simply the formatted result of a SQL query. You can generate reports by:
- Selecting and running a built-in wizard
-
- Defining a report region based on a SQL query
-
- Defining a report region based on a PL/SQL function returning a SQL query
-
The HTML DB Application Builder offers a great deal of flexibility in defining report attributes. Using the Report Attributes page, you can specify the report template, column display sequence, display report headings, column and heading alignments, column formatting, sort order and pagination.
Prerequisites
Using different report pagination styles
The HTML DB engine can paginate result sets of a report region in a variety of ways as figure 1 illustrates.
- Page result sets (that is "Internet style" pagination)
- Row ranges paginated by set (for example, Row(s) 1-10, 11-20, and 21-23)
- Row ranges in a self submitted select list (paginated by page)
- Row ranges paginated by page (for example, 1 - 10 of 23)
-
Fig. 1: Pagination Styles
Steps to modify report pagination:
Implementing a custom pagination style using report templates
If the build-in pagination styles do not meet the requirements of a particular application, you can implement a custom build pagination style by defining a pagination sub-template as part of your report template. In the following example we will define HTML based buttons to control navigating to the previous and next page of a report. The UI theme used in this example is the Opal theme, which is part of the HTML DB sample application. The sample application is installed as the default application when creating new workspaces.
- Figure 11 shows a report page using the Opal UI theme. The pagination style is a customized version of the "Row Ranges in Select List" pagination scheme.
-
Fig. 11: Report with custom built pagination style
- To achieve this pagination look, you need to modify your report template or create a new one from scratch. The sample application has a report template define which is called "Opal Alternating Report", other UI themes generally provide an "alternating row colors" report template that can also be used to define pagination sub-templates. Follow the steps below to build your own customized pagination style:
-
- Navigate to the Application Builder start page, either by clicking the "Application" parent tab or the "Home" link in the navigation bar.
- On the Application Builder start screen, click on the "Templates" tab.
- Scroll down to report templates and click on one of the provided report templates, in our example we use the template named "Opal Alternating Report".
- On the report template definition page, scroll down to "Pagination Subtemplate" (see fig. 12).
- Use the following attributes to define your pagination style:
-
- Pagination template: Define the look for the text portion of the pagination control, this could be row-ranges, a select list, search engine-style page numbers, etc., use the #TEXT# substitution string to indicate where to display the actual pagination text. The actual text is determined by the selected pagination scheme.
- Next Page and Previous Page: If the selected pagination scheme allows navigating from page to page, you can define the look of the navigation controls here, use images, hyper links, buttons, etc.
- Next set and Previous Set: If the selected pagination scheme allows navigating from one set of row ranges to the next set, you can define the look of the navigation controls here, use images, hyper links, buttons, etc.
- Click on apply changes to save the changes to your report template.
Fig. 12: Pagination Sub-Template
- To use the report template and the customized pagination style with your report, follow the steps below:
-
- Navigate to the report attributes page and scroll down to the region titled "Layout and Pagination".
- Pick a pagination scheme from the drop down select list titled "Pagination Schemes", in our example we used the "Row Ranges in Select List" scheme.
- Pick your report template, templates starting with "default" or "export" are build-in templates, following those template you'll find your own report templates, prefixed with the string "template:", pick the one you modified before.
- Click on apply changes to save the changes to your report and run your page.
Fig. 13: Report Attibutes, select report template
Discuss this how-to in the
OTN HTML DB Discussion Forum.
|