Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Oracle APEX Cookbook : Second Edition

You're reading from   Oracle APEX Cookbook : Second Edition Get straight into developing modern web applications, including mobile, using the recipes in this brilliant cookbook for Oracle Application Express (APEX). From the basics to more advanced features, it's a reference book and guide in one.

Arrow left icon
Product type Paperback
Published in Oct 2013
Publisher
ISBN-13 9781782179672
Length 444 pages
Edition Edition
Languages
Arrow right icon
Toc

Table of Contents (21) Chapters Close

Oracle APEX Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Creating a Basic APEX Application 2. Themes and Templates FREE CHAPTER 3. Extending APEX 4. Creating Websheet Applications 5. APEX Plug-ins 6. Creating Multilingual APEX Applications 7. APEX APIs 8. Using Web Services 9. Publishing from APEX 10. APEX Environment 11. APEX Administration 12. Team Development 13. HTML5 and CSS3 14. Mobile Index

Implementing an interactive report


In this recipe, we are going to create an interactive report and show you how to use it. An interactive report is a special kind of report, which offers a lot of options to the user for filtering, sorting, publishing, and much more.

Getting ready

It's always a good idea to start by creating a view that already selects all columns you want to show in your report. This simplifies the query required for your report region and separates the logic from presentation in your application architecture.

In this recipe, we are going to base the interactive report on the APP_VW_CONTACTS view that joins the tables for contacts, addresses, and communications. The query for this view is as follows:

select ctt.firstname
     , ctt.lastname
     , ctt.contact_type
     , ads.address_type
     , ads.address_line1
     , ads.address_line2
     , ads.postcode
     , ads.city
     , ads.state
     , ads.country
     , aac.default_yn
     , cct.id contact_id
     , ads.id address_id
  from app_contacts ctt
     , app_addresses ads
     , app_ads_ctt aac
 where aac.ctt_id = ctt.id
   and aac.ads_id = ads.id
[9672_01_01.txt]

We will also need a named LOV later on in the recipe. To create it, follow the next steps:

  1. Go to Shared Components and then to Lists of Values.

  2. Click on Create to make a new LOV.

  3. Create it from scratch and call it ADDRESS_TYPE; it should be a dynamic LOV.

  4. The query that it's based on is as follows:

    select rv_meaning display_value
         , rv_low_value return_value
      from app_ref_codes
     where rv_domain = 'ADDRESSES'
    [9672_01_02.txt]

How to do it...

The starting point for this recipe is an empty page, so the first thing that we're going to do is create a new region to contain the interactive report.

  1. Create a new region by right-clicking on the Regions label and selecting Create:

  2. Select Report as the type of region.

  3. Then select Interactive Report as the report implementation.

  4. Give the region a title Contacts.

  5. Select the value for Region Template APEX 4.0 – Reports Region. Keep the default values in the other fields.

  6. As the source for the region, enter the SQL Query:

    SELECT *
      FROM app_vw_contacts
    [9672_01_03.txt]
  7. Leave the other options with the default values.

  8. Click on Create Region to finish this part of the recipe.

    As you can see in the tree view, we now have a new region with all columns from the view:

    When we run the page now, we can already see some data. APEX also generated a toolbar above the report that we can use to filter data or change the way it is presented:

    The next step is to alter the report, so we can customize the column labels and change the way some of the data is presented.

  9. In the tree view of Page Definition, right-click on the Contacts region and select Report Attributes from the pull-down menu.

  10. Change the heading for the columns:

    • Firstname as First Name

    • Lastname as Last Name

    • Default Yn as Default Address?

  11. Click on Apply Changes to confirm the following changes.

    This changes the labels for some of the columns in the report. Next, we will change the presentation of the data inside one of the columns.

  12. Expand the tree view to show the content of Report Columns of the Contacts region.

  13. Right-click on ADDRESS_TYPE and click on Edit.

  14. Change the item Display Text As to Display as Text (based on LOV and escape special characters).

  15. Under List of Values, select Use Named List of Values to Filter Exact Match from the pull-down Column Filter List of Values.

  16. Select ADDRESS_TYPE as the value of Named List of Values.

  17. Click Apply Changes.

When we take a look at the page by clicking on we can see the changes to the column names and the Address Type no longer shows the abbreviation, but the full text:

There's more...

After the developer is done with creating an interactive report, the user will have a host of possibilities in the action menu to change the way the information is presented and filtered. These possibilities can be granted or revoked by the developer to an extent.

To see these options, right-click on the region and click on the option named Edit region attributes. When scrolling down this screen, you can see there are two sections: Search Bar and Download:

The first section holds the options that can be used in the Search Bar. When a user clicks on the Action button in the Search Bar, a menu will unfold revealing all the possible options. Data can be filtered, sorted, highlighted, and aggregated for instance. It's also possible for the user to generate a chart.

They can even save the changes made to the report for personal or public use, so other users can benefit as well:

The second section holds the file types that can be used to download the information in the interactive report. These include well-known formats such as CSV, PDF, and XLS:

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image