Creating a simple report

In our application we would also like to have an overview of all employees in the company. We can get this overview by creating a report. There are several types of reports and we just start with a simple report based on a query.

Getting ready

The starting point is our created application. You need an existing table, like EMP.

How to do it...

  1. In the application builder, go to the application we just created and click on the Create Page button.
  2. In the page type dialog, select Report.
  3. A page is shown where we can choose between the different types of reports. Options are: interactive report, classic report, report based on a web service result, and wizard report. We will choose classic report so select classic report.

    Some of the other types of reports will be covered in other recipes in this book. The next recipe is on Interactive Reports. In Chapter 8, Webservices, some examples of building reports on Webservices are explained. The option wizard report is not explained separately, because it just offers an easier, step-by-step way of building a report.

  4. In the next step you can assign a page number and a page name to the report. Furthermore you can indicate whether you would like to have breadcrumbs on your report page. Leave the breadcrumb option to "do not use breadcrumbs on page" and click Next.
  5. In this step you can choose to include tabs in your report page. We leave it to "do not use tabs". Click Next.
  6. In this step you must enter a query in the textarea. You can use the query builder to help you build your query, but you can also enter it manually. We use the following query:
    select *
    from emp
    
  7. After you have entered the query, click Next.
  8. In the next step you can define a number of settings such as the report template, the region name, the number of rows displayed per page, and whether the user should be able to print the report on paper or spool it to a comma separated file. Leave the options as they are and click Next.
  9. In the last step, you see the confirmation page. If the choices made are not satisfactory, click the previous button to go back and modify the options. Otherwise, click the finish button.

The report is ready now. You can edit the report to define the settings or you can run the report to see how it looks. The result should be something like this:

How to do it...

How it works...

When you look at the page in the Application Builder, you will see that APEX created a reports region.

  1. Right-click on the region name of the report and click Edit to see the details of the report.
  2. In the region source you can see the query you just entered. If you want to see the column details, click on the Report Attributes tab.
    How it works...
  3. Here you can modify the column heading, the heading alignment, or the names of the columns. To go more into detail about the column you can click on the pencil icon next to the column name.

    Sometimes in a project, the business case for a report changes. Instead of a classic report, the customer would like an Interactive Report. In case there are two options, remove the current report region and create a new one based on an Interactive Report or just migrate the current report using built-in functionality.

    When we are looking at the Region Definition tab of the Edit region page, we can see a Tasks list on the right side of the screen. One of the options is Migrate to Interactive Report. This migration is not a Holy Grail, but can save a lot of time in the migration process.

  4. Click the link to Migrate to Interactive Report.
  5. In the following page, enter EMPNO in the Unique Column field and click the Migrate button to see what happens.
How it works...

In the tree view of the page we can see that the old report region still exists but it's labeled Disabled. The new interactive report is added as we can see.

How it works...

More on Interactive Reports is explained in the following recipe.

See also

Chapter 8 explains (among many other things) how to create a report on Webservice references.

The next recipe "Implement an interactive report" explains how to build a page with an interactive report and what options there are when using them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.43.26