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
  • Oracle HTML DB




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

    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:
    1. Navigate to the Application Builder start page, either by clicking the "Application" parent tab or the "Home" link in the navigation bar.
    2. On the Application Builder start screen, click on the "Templates" tab.
    3. 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".
    4. On the report template definition page, scroll down to "Pagination Subtemplate" (see fig. 12).
    5. 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.
    6. Click on apply changes to save the changes to your report template.

    Fig. 12: Pagination Sub-Template

    Fig. 12: Pagination Sub-Template

  • To use the report template and the customized pagination style with your report, follow the steps below:
    1. Navigate to the report attributes page and scroll down to the region titled "Layout and Pagination".
    2. 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.
    3. 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.
    4. Click on apply changes to save the changes to your report and run your page.

    Fig. 13: Report Attibutes, select report template

    Fig. 13: Report Attibutes, select report template

Discuss this how-to in the OTN HTML DB Discussion Forum.