Skip Headers
Oracle® HTML DB 2 Day Developer
Release 1.6

Part Number B14377-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

1 How to Create a Tabular Form

A tabular form enables users to update multiple rows in a table at once using a single page. You can use the Tabular Form Wizard to create a tabular form that contains a built-in multiple row update process. This built-in process performs optimistic locking behind the scenes to maintain the data integrity.

This tutorial explains how to create a tabular form within an existing application and then how to change one of the updatable columns from a text field to a select list.

This section contains the following topics:

About Sample Application

Oracle HTML DB installs with a number of demonstration applications. In this exercise you will create a tabular form within the demonstration application, Sample Application.

To see if Sample Application is installed:

  1. Log in to Oracle HTML DB.

  2. From the Workspace Administration list, select Review Demonstration Applications.

  3. Locate Sample Application and check the Status column:

    1. If the Status column displays Installed, return to the Workspace home page.

    2. If the Status column displays Not Installed, select Install in the Action column.

    3. Follow the on-screen instructions.

Creating a Tabular Form Using a Wizard

The Tabular Form Wizard creates a form to perform update, insert, and delete operations on multiple rows in a database table. Additionally, the wizard creates a multiple row update process that checks for MD5 checksum values before doing the update in order to prevent lost updates. The following exercise creates a tabular form on the EMP table.

To create a tabular form using the Tabular Form Wizard:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select Sample Application.

  3. Click Create Page.

  4. On Create New Page, select Page with Component and click Next.

  5. On Select Component Type, select Form and click Next.

  6. On Create Page, select Tabular Form and click Next.

  7. On Identify Table/View Owner:

    1. From Table/View Owner, select the owner of the EMP table.

    2. From Allowed Operations, accept the default.

    3. Click Next.

  8. For Table/View Name, select EMP and click Next.

  9. On Identify Columns to Display:

    1. For Use User Interface Defaults, accept the default.

    2. For Select Columns, select the following columns:

      ENAME, JOB, HIREDATE, SAL, COMM
      
      

      Note:

      This exercise limits the number of columns to optimize the display on-screen. For a real form, you would probably want to include additional columns.
    3. Click Next.

  10. For Primary Key Column 1, accept the default EMPNO and click Next.

  11. For Source Type, accept the default Existing trigger and click Next.

  12. For Updatable Columns, select the following columns and click Next:

    JOB, HIREDATE, SAL, COMM
    
    
  13. On Identify Page and Region Attributes:

    1. For Page, enter 800.

    2. For Page Name, enter Tabular Form on EMP.

    3. For Region Name, enter Tabular Form on EMP.

    4. Click Next.

  14. On Identify Tab, accept the default, Do not use tabs, and click Next.

  15. On Button Labels:

    1. Accepts the defaults for the Cancel, Delete, and Add Row buttons.

    2. For the Submit button, enter Apply Changes.

    3. Click Next.

  16. Accept the remaining defaults, click Next, and then click Finish.

Next, run the page to view your new form.

To run the page:

  1. Click Run Page.

  2. If prompted to enter a username and password:

    1. For User Name, enter either demo or admin.

    2. For Password, enter the name of the current workspace using all lowercase letters.

    3. Click Login.

    4. Navigate to page 800:

      • Select Edit Page from the Developer Toolbar.

      • In Page, enter 800 and click Go.

      • Click the Run Page icon.

As shown in Figure 1-1, note the tabular form contains four buttons. Cancel, Delete, and Apply Changes display in the upper right corner and Add Row displays at the bottom. Additionally, a check box appears to the left of each row enabling the user to select one row at a time, or a user can select all rows at once by selecting the check box to the left of the column headings. The check box is used in conjunction with the Delete button to identify the rows to be deleted.

Figure 1-1 Tabular Form on the EMP Table

Description of tab_frm_1.gif follows
Description of the illustration tab_frm_1.gif

Changing Updatable Column Display Type

When the Tabular Form Wizard creates a tabular form, updatable columns display by default as text field. You can change this default display by editing report column attributes.

To change the default display of JOB to a select list:

  1. Navigate to the Page Definition for page 800. Select Edit Page from the Developer Toolbar.

  2. Under Regions, click Q next to Tabular Form.

    The Region Attributes page appears.

  3. Under Report Column Attributes, click the Edit icon next to the JOB column.

  4. Scroll down to Tabular Form Element. From Display As, select Select List (query based LOV).

  5. Under List of Values, enter the following LOV query:

    SELECT DISTINCT job a, job b FROM emp
    
    
  6. Click Apply Changes.

  7. Click the Run Page icon in the upper right corner the page.

    As shown in Figure 1-2, notice the Job column now displays as a select list.

    Figure 1-2 Job Column Changed to a Select List

    Description of tab_frm_lst.gif follows
    Description of the illustration tab_frm_lst.gif

Note:

Do not modify the select list of a SQL statement of a tabular form after it has been generated. Doing so can result in a checksum error when altering data of the form and applying updates.

Consider the following example:

SELECT ename FROM emp;

Note that this should not be altered to:

SELECT lower(ename) FROM emp