Skip Headers

Oracle® HTML DB User's Guide
Release 1.5

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

Go to previous page
Previous
Go to next page
Next
View PDF

8 Building Application Components

This section provides information about how to build different types application components in Application Builder.

This section contains the following topics:

Displaying Components on Every Page

Page zero of your application functions as a master page. The HTML DB engine renders all components you add to page zero on every page within your application. You can further control whether the HTML DB engine renders a component or runs a computation, validation, or process by defining conditions.

To create a page zero:

  1. Create a new page.

  2. Specify the page ID as zero (0).

Adding Navigation

When you build an application you can include a number of different types of navigation including tab sets, navigation bars, menus, trees, and lists. This section describes how to implement navigation in your application.

Topics in this section include:

Creating Tab Sets

Tabs are an effective way to navigate users between pages of an application. You can create a tabbed application look by using parent tabs, standard tabs, and Oracle HTML DB lists.

Application Builder includes two different types of tabs:

  • Standard tabs

  • Parent tabs

An application having only one level of tabs uses a standard tab set. A standard tab set is associated with a specific page and page ID. You can use standard tabs to link users to a specific page. A parent tab set functions as a container to hold a group of standard tabs. Parent tabs give users another level of navigation as well as a context (or sense of place) within the application. You can use parent tabs link users to a specific URL associated with a specific page.

The topics that follow describe how to add tab sets to your application.


Note:

When running the Create Application Wizard, you have the option of creating an application with tabs. The following procedures assume you have already created an application that does not have any tabs.

About Template Support

Before you can create parent and standard tabs, you need to check that your application level template has positions defined for both standard and parent tabs using the appropriate substitution strings. You also need to make sure you do not override this template at the page level.


See Also:


Using Tab Manager to Manage Tab Information

You manage tab information using Tab Manager. You can access Tab Manager from the Tabs tab or by clicking View from the Page Definition.

To access Tab Manager directly from Application Builder:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Select the Tabs tab.

    Tab Manager appears displaying a graphical representation of the tabs defined in your application.

  4. To make another tab current, click the tab.

    Note the two Add buttons. Use the Add button on the upper right side of the graphic to add Parent tabs. Use the Add button at the lower left side of the graphic to add standard tabs.

  5. To add a new tab, click Add adjacent to the appropriate tab type.

    Think of parent tabs as a container to hold standard tabs. For example, in order to add two levels of tabs you first create a parent tab and then add standard tabs to it.

To access Tab Manager from the Page Definition:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  4. Under Shared Components, click View to the right of the Parent Tabs or Standard Tabs heading.

    Tab Manager appears displaying a graphical representation of the tabs defined in your application. The currently selected standard or parent tab is highlighted.

  5. To make another tab current, click the tab.

  6. To add a new tab, click Add adjacent to the appropriate tab type.

About the Standard Tab Tasks List

You can also edit tabs from within Tab Manager by selecting an option from the Standard Tab Tasks list located in the bottom right of the page. For example, to add a new set of standard tabs, select Create a new tab set. To add a new standard tab, select Create new tab.

Creating a Navigation Bar

Navigation bars (see Figure 8-1) offer an easy way for users to move between pages in an application. The location of a navigation bar depends upon the associated page template. A navigation bar icon enables you to display a link from an image or text. A navigation bar entry can be an image, an image with text beneath it, or text. You must supply navigation bar entry images and text. When you create a navigation bar entry, you can specify an image, text, a display sequence, or an URL.

Figure 8-1 Navigation Bar Entry

Description of nav_bar_2.gif follows
Description of the illustration nav_bar_2.gif

The topics that follow describe how to create a navigation bar entry containing icons and a navigation bar without icons.

Creating a Navigation Bar Entry

Before you can add a navigation bar, you must create a navigation bar entry.

To create a navigation bar entry referencing an icon:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Select the NavBar tab.

  4. Run the Create NavBar Entry Wizard by clicking Create.

  5. Specify the following NavBar entry attributes:

    • Sequence

    • Alt Tag Text

    • Icon Image Name

    • Image Height and Image Width

    • Text

    Specify the target location.

  6. If the target location is an URL:

    • From Target type, select URL

    • In URL Target, type an URL

  7. If the target location is a page:

    • From Target type, select Page in this application

    • In Page, specify the page number

  8. If the navigation bar entry will display conditionally, specify the appropriate conditional information and click Create NavBar Entry.

To create a navigation bar entry without icons:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Select the NavBar tab.

  4. Run the Create NavBar Entry Wizard by clicking Create.

  5. Specify the following icon attributes:

    • Sequence

    • Text

  6. Specify the target location:

    • If the target is an URL, use f?p syntax to specify the location in the URL Target field. For example:

      f?p=160:5:&SESSION.
      
      
    • If the target is another page, enter the page number in the Page field.

  7. If the navigation bar entry will display conditionally, specify the appropriate conditional information and click Create NavBar Entry.

To manage navigation bar information:

  1. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  2. Click View to the right of the Navigation Bar heading.

    The Navigation Bar page appears.

  3. On the Navigation Bar page you can:

    • View details about a specific entry by clicking the edit icon

    • Access a grid view, by clicking Grid View

    • Create a new icon, by clicking Create

Creating Menus

Menus provide users with hierarchical navigation. A menu is a hierarchical list of links that display using templates. You can display menus as a list of links, or as a breadcrumb path.

As shown in Figure 8-2, a breadcrumb style menu indicates where the user is from a hierarchical perspective within the application. In addition, users can click a specific page to instantly view it. You can include a breadcrumb menu that functions as second level of navigation and displays beneath the standard tabs at the top of each page.

Figure 8-2 Breadcrumb Style Menu

Description of menu.gif follows
Description of the illustration menu.gif

Creating a Menu

Before you can add a menu to your application you must create it by running the Menu Wizard.

To create a menu:

  1. Click the Build icon.

  2. When Application Builder appears, select the Menus tab.

  3. To create a new menu, click Create and follow the on-screen instructions.

    Once your menu has been created, you need to add options to it.

  4. From the menu list, select the menu you just created and click Create Menu Options.

  5. On the Menu Options page, specify the following:

    • Page ID - Specify the page on which this menu will be current.

    • Display Sequence - Indicate the order in which menu options appear.

    • Parent Menu Option - Identify the parent of this menu entry.

    • Short Name - Specify the short name of this menu option (referenced in the menu template).

    • Long Name - Specify the long name of this menu option (referenced in the menu template).

  6. Specify a target location.

    If the target location is an URL:

    • From Target type, select URL

    • In URL Target, type an URL

    If the target location is a page:

    • From Target type, select Page in this application

    • In Page, specify the page number

  7. When you are finished defining menu attributes, click Create.

Repeat these procedures for each menu option you need to create.

Creating a Menu Template

A menu displays using a template.

To create a menu template:

  1. Click the Build icon.

  2. When Application Builder appears, select the Templates tab.

  3. Scroll down to Menu Templates, click Create/Copy.

    The Create Menu Template Wizard appears.

  4. From Create Menu Templates, select whether to create the template from scratch or by copying another template.

  5. If prompted, enter the appropriate HTML for your menu using the substitution strings:

    • #LINK# - The anchor target of the menu option.

    • #NAME# - The short name of the menu option.

    • #LONG_NAME# - The long name of the menu option.

Adding a Menu to a Page

Once you create a menu and a menu template, the next step is to add it a page by creating a region and specifying the region type as Menu.

To add a menu to a page:

  1. Click the Build icon.

  2. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  3. Under Regions, click Create.

  4. While running the Create Region Wizard:

    • Select Menu for the region type.

    • Enter a title.

    • Select a menu and menu template.

  5. Click Create Menu Region.

Repeat these procedures for each page on which you would like to add a menu.

About Creating a Dynamic Menu

To give users a more exact context, you may include session state in a menu, making your menus dynamic. For example, suppose a page in your application displays a list of orders for a particular company and you want to include the following breadcrumb menu:

Home > Orders > Orders for ACME Inc

In this example, ACME Inc not only indicates the page a user is on, but also the navigation path. The HTML DB engine stores the value of ACME Inc. in session state.

To create this type of dynamic menu, you must include a reference to a session state item in the menu's short name or long name, for example:

&COMPANY_NAME.

Creating Trees

You can create a tree in your application to effectively communicate hierarchical or multiple level data.

To create a tree:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Select the Trees tab and click Create.

  4. Follow the on-screen instructions to enter basic page information.

  5. Enter a Tree Name and specify the Default Expanded Levels.

  6. Under Start Tree, specify how the starting tree node is created:

    • Based on new item with popup list of values - Creates a tree based on a new item with a popup list of values (LOV). Requires an LOV query that selects, displays, and returns values from a tree table. Use this method to select a different starting point each time you visit a page.

    • Based on a SQL Query - Creates a tree based on a SQL query. Requires a SQL query that selects a primary key from a tree table.

    • Static value - Creates a tree based on a static value.

    Keep in mind that the option Based on new item with popup list of values enables you to select a different starting point each time you visit a page. The starting point for the last two options always remains the same.

    You build a tree based on a table that contains the node data. This base table must have an ID (a primary key) and a parent ID that functions as a foreign key of the table. These IDs determine the number of tree levels.

  7. Follow the on-screen instructions and specify the owner and name of the table from which the tree will be based.

  8. Under Link Option, select Existing flows item to make leaf node text a link.

Creating Lists

As shown in Figure 8-3, a list is a shared collection of links. You control the appearance of a list through list templates. Each list element has a display condition which enables you to control when it displays. You can define a list element to be either current or non current for a specific page. You further specify what current looks like using template attributes. You add a list to a page by creating a region and specifying the region type as List.

Creating a List

Before you can add a list to your application you must create it by running the Lists Wizard.

To create a list:

  1. Click the Build icon.

  2. When Application Builder appears, select the Lists tab.

  3. To create a new list, click Create List and follow the on-screen instructions.

    Once your list has been created, you need to add items to it.

  4. Select a list and click Create List Item.

  5. On the List Item page, specify the Label and Sequence attributes.

  6. Specify a target location.

    If the target location is an URL:

    • From Target type, select URL

    • In URL Target, type an URL

    If the target location is a page:

    • From Target type, select Page in this application

    • In Page, specify the page number

  7. When you are finished defining list attributes, click Create or Create and Create Another.

Adding a List on a Page

Once you created a list, the next step is to add it a page by creating a region and specifying the region type as List.

To add a list to a page:

  1. Click the Build icon.

  2. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  3. Under Regions, click Create to run the Create Region Wizard.

  4. Select List as the region type.

  5. Specify region attributes:

    • Enter a title

    • Select a region template

    • Specify a display point

    • Specify a sequence

  6. Click Create List Region.

Repeat these procedures for each page on which you would like to add a list.

About Creating a List Template

You control the appearance a list through list templates.

To create a new list template:

  1. Click the Build icon.

  2. When Application Builder appears, select the Templates tab.

  3. Scroll down to List Templates, click Create/Copy.

    The Create Menu Template Wizard appears.

  4. Specify how to create a new list template and follow the on-screen instructions.

Creating a Branch

A branch is an instruction to link to a specific page, procedure, or URL. For example you can branch from page 1 to page 2 after page 1 is submitted.

You create a new branch by running the Create Page Branch Wizard and specifying Branch Point and Branch Type. The Branch Type defines the type of branch you are creating.

To create a branch:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  4. Under Branching, click Create to run the Create Page Branch Wizard.

  5. Select a Branch Point:

    • On Submit: Before Computation - Occurs before computations, validations, or processing. Use this option for a Cancel button.

    • On Submit: Before Validation - Occurs after computations, but before validations or processing. Typically not used. If a validation fails, page processing stops, a rollback is issued, and the page displays the error. Because of this default behavior, you do not need to create branches to accommodate validations. However, you might want to branch based on the result of a computation (for example, to the previous branch point).

    • On Submit: Before Processing - Occurs after computations and validations, but before processing. Use this option to branch based on a validated session state, but before performing any page processing.

    • On Submit: After Processing - Occurs after computations, validations, and processing. This option branches to an URL or page after performing computations, validations, and processing. When using this option, remember to sequence your branches if you have multiple branches for a given branch point.

    • On Load: Before Header - Occurs before a page rendered. This option displays another page instead of the current page or redirects the user to another URL or procedure.

  6. Select a Branch Type.

    Depending upon the Branch Type, specify the following types of information on the pages that follows:

    • A page ID of the page you wish to branch to

    • PL/SQL code

    • An URL address

  7. Follow the on-screen instructions.

Creating Regions

A region is an area of a page that uses a specific template to generate HTML content. Each page can have any number of regions. You can use regions to group page components (such as items or buttons). You can create simple regions that do not generate additional HTML, or create elaborate regions that frame content within HTML tables or images.

Regions display in sequence within HTML table columns. You can also explicitly place regions in positions defined in the page template. You can also choose to display regions conditionally.

Topics in this section include:

Creating New Regions

You create new regions by running the Create Region Wizard.

To create a new region:

  1. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  2. Under Regions, click Create.

    The Create Region Wizard appears.

  3. Select a region type and follow the on-screen instructions.

When you create a region you select a region type. The HTML DB engine interprets a region differently based the type you select. Table 8-1 describes available region types.

Table 8-1 Region Types

Region Type Description
HTML HTML regions contain HTML you provide. They are also used as containers for items. Any HTML you type may contain substitution strings.
Report Report regions can be defined by a SQL query you write, or by using a wizard to guide you through the steps needed to write a query.

See Also: "Creating Reports"

Chart Chart regions contain line, bar, or pie charts based on SQL queries.

See Also: "Creating Charts"

List List regions are used for navigation and may consist of links or images. Individual list entries can be conditionally displayed.

See Also: "Creating Lists"

Menu Menu regions are navigational controls consisting of predefined, hierarchically organized links.

See Also: "Creating Menus"

PL/SQL Dynamic Content Regions based on PL/SQL enable you to render any HTML or text using the PL/SQL Web Toolkit.
Other, HTML Text (escape special characters). Same as HTML region, but the HTML DB engine escapes special characters before they are rendered.
Other, HTML Text (with shortcuts) Same as HTML region, but with support for shortcuts.

See Also: "Utilizing Shortcuts"

Other, Help Text Help regions enable you to provide page level help.

See Also: "Creating a Help Page"

Other, URL URL based regions obtain their content by calling a Web server using a predefined URL.

See Also: "About Regions Based on an URL"

Other, Web Service Result Web service based regions call a predefined Web service to obtain an XML document. An optional XSLT style sheet may be applied.

See Also: "Implementing Web Services"

Other, Tree Trees are a hierarchical navigational control based on a SQL query executed at runtime. It enables the user to expand an collapse nodes.

See Also: "Creating Trees"



See Also:


Building a Form Using a Region

The easiest way to create a region that contains a form is to use the Form on Table or View Wizard. This wizard creates one item for each column in a table. It also includes the necessary buttons and processes required to insert, update, and delete rows from the table using a primary key. Each region has a defined name and display position all other attributes are items, buttons, processes, and branches.

You can also create a form manually by performing the following steps:

  • Create an HTML region (to serve as a container for your page items)

  • Create items to display in the region

  • Create processes and branches

Building a Report Using a Region

When you define a Report region, you must select one of the following options:

  • Easy Report - This report does not require any SQL knowledge. You simply select the appropriate schema, table, columns, and result set display.

  • SQL Report - This report requires some SQL knowledge. When prompted, you enter a SQL query.

  • PL/SQL Function Returning SQL Query - This report requires some PL/SQL knowledge. When prompted, you enter a function that returns a SQL query.

    This method of defining a report is used when the structure of the query varies based on user input or another session state (for example, if the query is determined at runtime rather than beforehand).

    The following example returns all employees from the emp table whose name is similar to the value typed into an page item called search_string.

    SELECT ename, job, deptno, sal 
    FROM   emp 
    WHERE  upper(ename) LIKE '%'||upper(:search_string)||'%';
    
    

    Both the ename column of the emp table and the page item search_string are converted into upper case. Using the like operator and appending a percent sign to each side of value of the search_string creates a wild card search

About Regions Based on an URL

Typically, pages in an application are based on data stored in an Oracle database. To incorporate content from other servers, you can use regions based on a URL. For example, suppose you wanted to reference the current Oracle stock price. You could create a region of type URL based on an URL such as the following:

http://quote.yahoo.com/q?d=b&s=ORCL

You could then create a item called STOCK_SYMBOL and base your region on a stock price entered by the user. For example:

http://quote.yahoo.com/q?d=b&s=&STOCK_SYMBOL.

Sometimes (as is the case with the previous example) the HTML returned to the region is more than is needed. To restrict the HTML displayed you can use the following region attributes:

  • URL (discard until but not including this text)

  • URL (discard after and including this text)

Note that the previous example may require that you set the Proxy Server application attribute. If you do not set the Proxy Server application attribute, you will get an error message. Oracle HTML DB uses the Oracle utl_http.request_pieces function to obtain the HTML generated from the given URL.


See Also:

"Editing Application Attributes" for more information on setting the Proxy Server application attribute

About Regions Based on PL/SQL Dynamic Content

If you need to generate specific HTML content not handled by Oracle HTML DB forms, reports, and charts, you can use the region type PL/SQL. To generate HTML in this type of region, you need to use the PL/SQL Web Toolkit. You can reference session state using bind variable syntax. Keep in mind that when you generate HTML in this way you do not get the same consistency and control provided with templates.


See Also:


To give you more control over HTML dynamically generated within a region, you can use PL/SQL. For example, to print the current date you could create a region with the following source:

htp.p(TO_CHAR(SYSDATE,'Day Month DD, YYYY'));

This next example accesses tables:

DECLARE
   l_max_sal NUMBER;
BEGIN
   SELECT max(sal) INTO l_max_sal FROM emp;
   htp.p('The maximum salary is: '||TO_CHAR(l_max_sal,'999,999.00'));
END;

Creating Buttons

As you design your application you can use buttons to direct users to a specific page or URL, or to post or process information (for example, by creating Create, Cancel, Next, Previous, or Delete buttons).


See Also:

"About Buttons" for more information on button naming, branching, and defining other button attributes

Using the Create Button Wizard

You create a button by running the Create Button Wizard from the Page Definition.

To create a new button:

  1. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  2. Create an HTML region. (See "Creating New Regions".)

  3. Under Button, click Create.

    The Create Button Wizard appears.

  4. Select a Task:

    • Create a button displayed among this region's items

    • Create a button in a region position

    Select Create a button displayed among this region's items to add a button to a region as if it was an item (for example, to add a button directly to the right of a form field).

  5. Select an Action:

    • Submit page and redirect to URL - Selecting this action submits the current page to the HTML DB engine whenever a user clicks the button.

    • Redirect to URL - Selecting this option avoids submitting the page. Choose this action when submitting the page for processing is not necessary (for example, a Cancel button). This action avoids processing in the database and therefore reduces the load.

  6. Select a Button Type:

    • HTML Button (Default)

    • Image

    • Template Driven

  7. Select Button is Reset to create an Undo button. When enabled, this type of button resets the page values to the state they were in when the page was initially rendered.

The sections that follow offer brief descriptions of how to create specific types of buttons.

Creating an HTML Button

Buttons can be placed in predefined region template positions or among items in a form. To create an HTML button, select one of the following while running the Create Button Wizard:

  • Under Task, select Create a button in a region position

  • Under Button Type, select a button type and then HTML Button (default)

Creating Lists of Values

A list of values (LOV) is a static or dynamic definition used to display the following types of items:

Creating LOVs

You define shared (or named) LOVs at the application level by running the LOV Wizard and adding them to the Named List of Values repository. All LOVs can be defined as static or dynamic. Static lists are based on predefined pairs of display and return values. Dynamic lists are based on a SQL query you write that selects values from a table.

To create a named LOV:

  1. Click the Build icon.

  2. When Application Builder appears, select the LOVs tab.

  3. To create a new LOV, click Create.

  4. Follow the on-screen instructions.

Referencing Session State within a LOV

You can reference session state by using bind variables. In the following example, this LOV only works if the item called my_deptno contains a valid department number.

SELECT ename, empno FROM emp WHERE deptno = :my_deptno

Inline Static LOV

Static LOVs are based on a static list of display and return values you specify when you run the LOV Wizard. To create a static LOV you run the LOV Wizard and select the LOV type Static. Oracle HTML DB stores the display values, return values, and sort sequence you specify in the Named List of Values repository. Once you add a static LOV to the repository you can create an item and display it as a check box, radio group, select list, or popup lists based on this definition.

You can also use a shorthand syntax to create a static LOV. Simply provide a comma delimited string of values prefaced by the text STATIC:. The following example creates a static list containing the options Yes and No.

STATIC:Yes,No

In this next example, the LOV would display Yes and No, but would return 1 and 2.

STATIC:Yes;1,No;0

Instead of using a semicolon (;) to delimit values, you can indicate your own delimiters. This is useful approach when the values themselves contain commas. Keep in mind, using your own delimiters can be problematic if your application needs to be translated. The following example uses a tilde (~) and a percent sign (%).

STATIC(~,%):Run and Build Flow%RUN_AND_BUILD~Run Flow Only%RUN_ONLY

To sort the results in the order they were typed, using the following syntax:

STATIC2:1,5,10,20,30

Popup LOV

Using a popup LOV is a good choice for lists of values that are too large to return on a single page. Popup LOVs create an icon to the right of a standard text field. When the user clicks this icon a popup window appears with a list of values represented as a series of links. When the user selects from this searchable list, the selected value will be placed in the text field. You control popup LOVs through templates. You can only specify one popup LOV template for each application.

Popup LOVs must be based on a query that selects two columns with different column aliases. For example:

SELECT ename name, empno id 
   FROM emp

Creating Forms

You can include a variety of different types of forms in your applications. You can include forms that enable users to update just a single row in a table or multiple rows at once. Oracle HTML DB includes a number of wizards you can use to create forms automatically, or you can create forms manually.

Topics in this section include:

Using a Wizard to Build a Form

Oracle HTML DB includes the number of wizards for creating forms. These wizards create complete pages you can later customize.

To create a form using a wizard:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Click the Wizards tab.

  4. Under Forms, select a wizard.

    Table 8-2 describes the available wizards you can use to create forms.

    Table 8-2 Forms Wizards

    Wizard Description
    Form on Table or View Creates a form users can use to update a single row in a database table.
    Form on Procedure Builds a form based on a stored procedure arguments. Use this approach when you have implemented logic or DML (Data Manipulation Language) in a stored procedure or package.
    Form on SQL Query Creates a form based on the columns returned by a SQL query such as an equijoin.
    Form on a Table with Report Creates two pages. One page displays a report. Each row provides a link to the second page to enable users to update each record.
    Summary Page Creates a read-only version of a form. Typically used to provide a confirmation page at the end of a wizard.
    Tabular Form Creates a form in which users can update multiple rows in a database.

  5. Follow the on-screen instructions.

Creating a Form Manually

To create a form manually:

  1. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  2. Create an HTML region:

    • Under Regions, click Create

    • Select the region type HTML

    • Follow the on-screen instructions.

  3. Start adding items to the page:

    • Under Items, click Create

    • Follow the on-screen instructions

Processing a Form

Once you create a form, the next step is to process the data a user types by inserting into or updating the underlying database tables or views. There are three ways to process a form:

  • Create one or more processes containing INSERT, UPDATE and DELETE (DML) statements.

  • Call an API using a PL/SQL package you create to pass values.

  • Use a built-in Automatic Row Processing (DML) process.

Creating an Automatic Row Processing Process

One common way to implement a form is to manually create an Automatic Row Processing (DML) process. This approach offers two primary advantages. First, you are not required to provide any SQL coding. Second, Oracle HTML DB performs DML processing for you.

In order to implement this approach you need to:

  • Add items and define the Item Source Type as Database Column and specify a case sensitive column name.

  • Select the option Always overrides the cache value.

To create an Automatic Row Processing (DML) process:

  1. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  2. Under Processes, click Create.

    The Create Page Process Wizard appears.

  3. In the Name field, type a name to identify the process.

  4. In the Sequence field, specify a sequence number.

  5. From the Point list, select the appropriate processing point. In most instances, select Onload - After Header.

  6. From the Type list, select Automated Row Processing (DML).

  7. Follow the on-screen instructions.

Creating a Process Containing One or More Insert Statements

In this approach to form handling, you create one or more processes to handle insert, update and delete actions. Instead of having the HTML DB engine handling everything transparently, you are in complete control.

For example, suppose you have a form with three items:

  • P1_ID - A hidden item to store the primary key of the currently displayed row in a table.

  • P1_FIRST_NAME - A text field for user input.

  • P1_LAST_NAME - A text field for user input.

Assume also there are three buttons labeled Insert, Update, and Delete. Also assume you have a table T which contains three columns, ID, FIRST_NAME, and LAST_NAME. The table has a trigger which automatically populates the ID column when there is no value supplied.

To process the insert of a new row, you create a conditional process of type PL/SQL that executes when the user clicks the Insert button. For example:

BEGIN
    INSERT INTO T ( first_name, last_name )
               VALUES  (:P1_FIRST_NAME, :P1_LAST_NAME);
END; 

To process the update of a row, you create another conditional process of type PL/SQL. For example:

BEGIN
    UPDATE T
           SET first_name = :P1_FIRST_NAME,
                  last_name = :P1_LAST_NAME
     WHERE ID = :P1_ID;
END; 

To process the deletion of a row, you create a conditional process that executes when the user clicks the Delete button. For example:

BEGIN
    DELETE FROM T
    WHERE ID = :P1_ID;
END;

Using a PL/SQL API to Process Form Values

For certain types of applications it is appropriate to centralize all access to tables in a single or few PL/SQL packages. If you have created a package to handle DML operations, you can call procedures and functions within this package from a After Submit PL/SQL process to process insert, update and delete requests.

Populating Forms

Oracle HTML DB populates a form on load, or when the page is being rendered. You can populate a form in the following ways:

  • Create a process and define the type as Automated Row Fetch.

  • Populate the form manually by referencing a hidden session state item.

To create an Automated Row Fetch process:

  1. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  2. Under Processes, click Create.

    The Create Page Process Wizard appears.

  3. In the Name field, type a name to identify the process.

  4. In the Sequence field, specify a sequence number.

  5. From the Point list, select the appropriate processing point.

  6. From the Type list, select Automated Row Fetch.

  7. Follow the on-screen instructions.

You can also populate a form manually by referencing a hidden session state item. For example, the following code in an Oracle HTML DB process of type PL/SQL would set the values of ename and sal. The example also demonstrates how to manually populate a form by referencing a hidden session state item named P2_ID.

FOR C1 in (SELECT ename, sal
FROM emp WHERE ID=:P2_ID)
LOOP     
     :P2_ENAME := C1.ename;
     :P2_SAL := C1.sal;
END LOOP;

In this example:

  • C1 is an implicit cursor

  • The value of P2_ID has already been set

  • The process point for this process would be set to execute (or fire) on or before Onload - Before Regions

Validating User Input in Forms

You can use validations to check data a user types prior to processing. Once you create a validation and the associated error message, you can associate it with a specific item. You can choose to have validation error messages display inline (that is, on the page where the validation is performed) or on a separate error page.

Creating an inline error message involves these steps:

  • Create a new validation and specify error message text

  • Associate the validation with a specific item

To create a new validation:

  1. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  2. Under Validations, click Create.

  3. When the Create Validations Wizard appears, follow the on-screen instructions.

    Validations Types are divided into two categories:

    • Item. These validations start with the phrase "Item" and provide common checks you may want to perform on the item that the validation is associated with.

    • Code. These validations require you provide either a piece of PL/SQL code or SQL query that defines the validation logic. Use this type of validation to perform custom validations that require verifying values of more than one item or accessing additional database tables.

  4. Follow the on-screen instructions.

To associate an item with a validation and specify error message text:

  1. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  2. Under Validations, select the validation item you want to associate.

  3. Scroll down to Error Messaging:

    • In Error message display location, verify the display location

    • In Associated Item, select the item you want to associate with this validation

Creating Reports

In Oracle HTML DB a report is simply the formatted result of a SQL query. You can generate reports by:


See Also:

"Building a Report Using a Region" for more information on defining a report region

Topics in this section include:

Using a Wizard to Create a Report

Oracle HTML DB includes the number of built-in wizards for generating reports.

To create a report using a wizard:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Click the Wizards tab.

  4. Under Reports, select a wizard.

    Table 8-3 describes the available wizards you can use to create reports.

    Table 8-3 Reports Wizards

    Wizard Description
    Easy Report Builds a report page based on the owner, table, columns, and templates you specify. This report does not require any manual SQL coding.
    SQL Report Builds a report page based on a custom SQL statement you provide.
    Report with link to form on table (2 pages) Builds a two page report. The first page enables users to specify the row to be updated. The second page provides users with a form to update or insert the selected row.

  5. Follow the on-screen instructions.

Managing Report Attributes

Application Builder offers a great deal of flexibility in defining report attributes. Using the Report Attributes page, you can specify the column display sequence, display report headings, column and heading alignments, column formatting, and sort order. You can further refine attributes of a specific column using the Column Attributes page.

Topics in this section include:

Accessing Report Attributes

Using the Report Attributes and Column Attributes pages you can precisely control the look and feel of reports.

To access the Report Attributes page:

  1. From the Available Applications list, select an application and click Go.

  2. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  3. Under Regions, click Q next to the name of the report region you want to edit.

    The Report Attributes page appears.

  4. Under Report Column Attributes, you can:

    • Click the arrows to change the column display sequence.

    • Under Heading, specify different column headings.

    • Under Column Align., select the column alignment.

    • Under Heading Align., select the heading alignment.

    • Select Show to determine whether the column displays.

    • Click Sum to enable the sum of a column.

    • Click Sort and select a sequence number from Sort Sequence to specify a unique sort sequence.

    You can further refine attributes of a specific column on the Column Attributes page.

  5. Under the Report Column Attributes, click the edit icon adjacent to the appropriate column name.

    The Column Attributes page appears, containing the following sections:

    • Column Definition

    • Column Formatting

    • Column Link

    • Updatable Column Attributes

    • List of Values

    • Authorization

    • Conditional Display

About Column Definition

The Column Definition section of the Column Attributes page contains the same options available on the Report Attributes page. For example, you can specify a column heading, determine whether a column should display in the report, whether to calculate and display a column sum, enable sorting, as well as specify column and column heading alignment.

About Column Formatting

You can use the following Column Formatting properties to further customize column display:

  • Number/Date Format defines a number and date format mask to be applied to a numerical column.

  • CSS Class defines CSS classes to be applied to a column value.

  • CSS Style defines a CSS style to be applied to a column value.

  • Highlight Words specifies text strings to be highlighted in a report column. For multiple highlighted words, use a comma delimited list. Application or page items can be referenced using &ITEM. syntax. (For example, to highlight strings entered into a search field.)

  • HTML Expression specify an HTML expression to be displayed in the column. Use #COLUMN# syntax to show column values in HTML.

Enabling Column Sorting

You enable column sorting on either Report Attributes or Column Attributes pages.

To enable column sorting on the Report Attributes page:

  1. Navigate to the Report Attributes page. (See "Accessing Report Attributes".)

  2. Under Report Column Attributes, click Sort adjacent to the column to be sorted.

  3. Under Sorting, specify ascending and descending image attributes or click set defaults.

Exporting a Report

You can export a report as either a comma delimited file (.csv) or XML file. You specify an export format by selecting a report template.

To specify an export report template:

  1. Navigate to the appropriate Report Attributes page. (See "Accessing Report Attributes".)

  2. Under Layout and Pagination, select one of the following from the Report Template list:

    • export: CSV exports the report as a CSV file

    • export: XML exports the report as a XML file

    Selecting either option prevents the HTML DB engine from rendering the page and dumps the content to either a CSV or XML file.

    You can use the options under CSV Output to create a link that downloads the content of the report.

  3. Scroll down CSV Output.

  4. To create a link that downloads the content of a report:

    • From the Enable comma separated values (CSV) output list, select Yes.

    • In the CSV download link label field, specify link text. This text will display in your report and enable users to invoke a download.

Creating a Column link

Using Column Link attributes, you can create a link from a report to another page.

To create a column link:

  1. Navigate to the appropriate Column Attributes page. (See "Accessing Report Attributes".)

    The Column Attributes page appears.

  2. Scroll down to Column Link.

  3. In Application, specify the target application ID. To specify the current application, use the following substitution string:

    &APP_ID.
    
    
  4. In Request, specify the request to be used.

  5. In Clear Cache, specify the pages (that is, the page ID) on which to clear cache. You can specify multiple pages by listing the page ID in a comma delimited list.Use the Name and Value fields to specify session state for a specific item.

  6. In Link Text, enter text to be displayed as a link, specify an image tag, or pick from the list of default images.

  7. Click Generate Link.

Defining Updatable Columns

You can define how updatable forms display on the Column Attributes page.

To define updatable column attributes:

  1. Navigate to the appropriate Column Attributes page. (See "Accessing Report Attributes".)

    The Column Attributes page appears.

  2. Scroll down to Updatable Column Attributes.

  3. From Display As, select a type of updatable column.

  4. In Width and Height, specify the width and height of the form item.

  5. In Element Attribute, define a style or standard form element attribute.

  6. In Element Option, specify form element attributes for items in a radio group or check box.

Defining a Column as a List of Values

Report columns may be rendered as lists of values. For example, a column can be rendered using a select list or a popup list of values.

To specify column LOV attributes:

  1. Navigate to the appropriate Column Attributes page. (See "Accessing Report Attributes".)

    The Column Attributes page appears.

  2. Scroll down to Updatable Column Attributes.

  3. From Named LOV, select a named LOV from the Named List of Values repository.

  4. In Display Null, specify whether to include a display null value.

  5. In Null Text, specify the value to be returned if Display NULL is selected.

  6. If you have not already selected a named LOV, specify a query used to display a select list in LOV Query.

Controlling When Columns Display

You can use the Authorization and Conditional Display attributes to control when a column displays.

Authorization enables you to control access to resources (such as a report column) based on predefined user privileges. For example, you could create an authorization scheme in which only managers can view a specific report column. Before you can select an authorization scheme, you must first create it.

A condition is a small unit of logic that enables you to control the display of a column based on a predefined condition type. The condition evaluates to true or false based on the values you enter in the Expressions fields.

To specify Authorization and Conditional Display attributes:

  1. Navigate to the appropriate Column Attributes page. (See "Accessing Report Attributes".)

  2. From Named LOV, select a named LOV from the Named List of Values repository.

  3. Under Authorization, make a selection from the Authorization Scheme list.

  4. Under Conditional Display, make a selection from the Type list and depending upon the selected type, enter an expression or value in the appropriate Expression fields.

Controlling Column Breaks

You can control whether a specific column repeats and how column breaks appear when printed using Break Formatting attributes. For example, suppose your report displays employee information by department number. If multiple employees are members of the same department, you can increase the readability by specifying the department number only appears once.

To create this type of column break:

  1. Navigate to the appropriate Report Attributes page. (See "Accessing Report Attributes".)

  2. Scroll down to Break Formatting.

  3. Make a selection from the Breaks list.

Creating a Report with Pagination

The HTML DB engine can paginate result sets of a report region in the following ways:

  1. Use of conditional buttons and branches, such as Next and Previous buttons to create a custom pagination scheme.

  2. Page result sets (that is "Internet style" pagination).

  3. Row ranges paginated by set (for example, Row(s) 1-10, 11-20, and 21-23).

  4. Row ranges in a self submitted select list (paginated by page).

  5. Row ranges paginated by page (for example, 1 - 10 of 23).

You can control options 2, 3, and 4 using report templates, specifically the #PAGINATION# substitution string in the After Rows report template attribute.

You can implement options 2, 3, 4, and 5 by configuring report region attributes to enable pagination.

To configure report region attributes to enable pagination:

  1. Create a region based on a SQL query. (See "Building a Report Using a Region".)

  2. Under Regions, click Q next to the name of the report region you want to edit.

    The Report Attributes page appears.

  3. To change pagination, scroll down to Layout and Pagination and select a new Pagination Scheme.

  4. To save your changes, click Apply Changes.

Creating Charts

Oracle HTML DB includes built-in wizards for generating HTML and SVG (Scalable Vector Graphics) charts.

To create a chart using a built-in wizard:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Click the Wizards tab.

  4. Under Charts, select a wizard.

    • HTML Chart creates a single page containing an HTML horizontal or vertical bar chart.

    • SVG Chart creates a SVG (Scalable Vector Graphics) chart.

  5. Follow the on-screen instructions.

Creating Calendars

Oracle HTML DB includes a built-in wizard for generating a monthly calendar. Once you specify the table on which the calendar is based you can create drill down links to information stored in specific columns.

To create a calendar using a built-in wizard:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Click the Wizards tab.

  4. Under Calendar, select Monthly Calendar.

  5. Follow the on-screen instructions.

Specifying Layout and User Interface

This section describes how to implement common application layout and user interface techniques.

Topics in this section include:

Creating a Multiple Column Layout

A region is an area of a page that uses a specific template to format HTML content. You use regions to group page components and items. To create a multiple column layout, you create two regions that display in adjacent cells of the same table.

You can create a multiple column layout by either:

  • Manually creating the two adjacent regions

  • Defining a page template that contains a multiple column table

Creating Regions in Multiple Columns

You create new regions using the Create Region Wizard. To create a two column page, you create two regions. Oracle HTML DB replaces #BOX_BODY# within a two column table and displays the regions in two separate cells.

To create a two column page by creating regions:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Navigate to the appropriate Page Definition. (See "Viewing a Page Definition".)

  4. Create the first region:

    • Under Regions, click Create.

      The Create Region Wizard appears.

    • Select a region type.

    • From the Column field, select 1.

    • Follow the on-screen instructions.

  5. Create the second region:

    • Under Regions, click Create.

      The Create Region Wizard appears.

    • Select a region type.

    • From the Column field, select 2.

    • Follow the on-screen instructions.

Creating a Multiple Column Page Template

Page templates define the appearance of individual pages, including the placement of page components. Each page template is divided into three sections: Header, Body, and Footer. The most basic template must include the substitution string #BOX_BODY# in the Body attribute. When the page is rendered, the HTML DB engine replaces #BOX_BODY# with HTML to display the regions on that page.

You can create a multiple column page by defining a page template that contains a multiple column table. You then explicitly place regions within specific table cells.

The following example demonstrates how to create a two column page and specify a region position using the #REGION_POSITION_XX# substitution string in each column. You would enter this code in the Body section of the page level template.

<body #ONLOAD#>
  #FORM_OPEN#
  <table style="width:100%">
    <tr>
      <td style="width:50%;padding:5px;">#REGION_POSITION_01#</td>
      <td style="width:50%; border-left:2px #bbbbbb dashed; padding:5px;">#REGION_POSITION_02#</td>
    </tr>
  <br />
  #BOX_BODY#
  #FORM_CLOSE#
</body>

Once you create this page level template, the newly defined positions would be available as Display Point options when you run the Create Region Wizard.

Using a LOV to Drive Another LOV

You may use a select list to determine the range of values of another select list on the same page. You can achieve this functionality by having a driving select list submit values to a subsequent select list. You incorporate these values in the subsequent select list as a bind variable in the WHERE clause of its query.

You can have one LOV drive another LOV by:

Specifying Print Preview Mode

You can optimize a page for printing by creating a specific Print Mode template and specifying that template in the User Template Defaults section of the Edit Application Attributes page. Generally, a Print Mode template optimizes a page for printing. For example, this template might:

  • Not display tabs or navigation bars

  • Have items display as text instead of form elements

If the UI theme you select does not include a printer friendly template, you can create a Print Mode template by creating a new page template. Although you can create a new page template from scratch, it is generally easier to make a copy of an existing template and then customize it to meet your needs.

To create a new page template:

  1. Click the Build icon.

  2. Select the Templates tab.

  3. Scroll down to the appropriate template type and click Create/copy

  4. Follow the on-screen instructions.

Setting a Print Mode Template for an Application

You enable your Print Mode template by selecting it in User Template Defaults section of the Edit Application Attributes page.

To enable Print Mode mode:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Select the Edit Attributes icon.

    The Edit Application Attributes page appears.

  4. Scroll down to User Interface Templates.

  5. From Print Mode Page Template, select your Print Mode template.

Using f?p Syntax to Toggle to Print Mode

Once you create a Print Mode template and select it as an application attribute, you can use f?p syntax to toggle to Print Mode. The ninth f?p syntax argument (PrinterFriendly) enables you turn to this preference on or off. For example, you could include this argument when coding a link, or creating navigation bar icon.

Utilizing Shortcuts

By using shortcuts you can avoid repetitive coding of HTML or PL/SQL functions. You can use a shortcut to define a component such as a button, HTML text, a PL/SQL procedure, or HTML. Once defined, you can invoke a shortcut using specific syntax unique to the location in which the shortcut is used. Shortcuts can be referenced many times, thus reducing code redundancy.

Defining Shortcuts

Before you can incorporate a shortcut in your application, you must define it and add it to the Shortcuts repository. You reference new shortcuts using the following syntax:

"MY_SHORTCUT"

Note that the shortcut name must be capitalized and enclosed in quotes.

To define a new shortcut:

  1. Click the Build icon.

  2. Select the Shortcuts tab.

  3. Click Create.

  4. Follow the on-screen instructions.

New shortcuts are added to the Shortcut repository and are available for use within the following locations:

Creating a Help Page

Oracle HTML DB includes built-in attributes to make creating help for your application quick and easy. Creating help for your application involves the following steps:

Help created in Oracle HTML DB displays on a dedicated help page. To access help, users click a link that takes them to a dedicated help page. This help page displays page and item help topics specific to the page they are viewing.

Topics in this section include:

Creating a Help Page and Region

The first step in creating a help for your application it to create a dedicated page and Help Text region.

To create a new help page:

  1. Click the Build icon.

  2. From the Available Applications list, select an application and click Go.

  3. Navigate to a specific page, by either:

    • Entering the page ID in the Edit Page field and click Go

    • Clicking a page name

  4. Under Page in Page Rendering, click Create.

  5. When prompted to select a region type, click Other and then select Help Text.

  6. Follow the on-screen instructions.

To create a new Help Text region:

  1. Navigate to the Page Definition of your help page.

  2. Under Regions, Create.

  3. When prompted to select a region type, click Other and then select Help Text.

  4. Follow the on-screen instructions.

Defining Help Text

You define page and item help text as an attribute of the page and item. Ideally, you would define these attributes as you create your application. For simplicity, however, the following procedures describe how to define this text after the fact.

To define page help text:

  1. Navigate to the Page Definition for the page for which you want to add page help.

  2. Under Page, click Edit to view the existing page attributes.

  3. Scroll down to Page Help Text.

  4. Enter your help text in the field provided.

  5. Click Apply Changes.

Repeat the previous procedure for each page requiring page help text.

To define item help text:

  1. Navigate to the Page Definition for the page for which you want to add item help.

  2. Under Items, click name of the item you want to edit.

  3. Scroll down to Help Text.

  4. Enter your help text in the field provided.

  5. Click Apply Change.

Repeat the previous procedure for each item requiring help text.

Creating a Help Navigation Bar Icon

Once you have created your help, the next step is to create a navigation bar icon so users can link to it.

To create a navigation bar icon:

  1. Navigate to the Page Definition.

  2. Under Navigation Bar, click Create.

  3. Specify the appropriate NavBar entry attributes:

    • Sequence

    • Alt Tag Text

    • Icon Image Name

    • Image Height and Image Width

    • Text

    Specify the target location.

  4. To specify the target location:

    • From Target type, select Page in this application.

    • In Page, specify the page number.

    • In Request, type:

      &APP_PAGE_ID.
      
      

    By specifying substitution string &APP_PAGE_ID as the Request, you are instructing the HTML DB engine to display help text for the current page when the user clicks this icon.

Sending E-mail from an Application

You can send an e-mail from an Oracle HTML DB application by calling a PL/SQL package called HTMLDB_MAIL. This package is built on top of the Oracle supplied UTL_SMTP package. Because of this dependence, in order to use HTMLDB_MAIL, the UTL_SMTP package must be installed and functioning.


See Also:

PL/SQL Packages and Types Reference for more information about the UTL_SMTP package

The most efficient approach to sending mail is to create a background job (or DBMS_JOB package) to periodically send all mail messages stored in the active mail queue. DBMS_JOB package is automatically created when you install Oracle HTML DB. This package pushes the mail queue every 15 minutes. DBMS_JOB package has two parameters: The default p_smtp_host is localhost and the default p_smpt_portno is 25 on install.


See Also:

"Managing Engine Settings" for more information on changing these default values

To enable a user to send an outbound e-mail message from your application, you invoke the HTMLDB_MAIL.SEND procedure.

Oracle HTML DB stores unsent e-mail messages in a table named HTMLDB_MAIL_QUEUE. You can deliver mail messages stored in this queue to the specified SMTP gateway by invoking the procedure HTMLDB_MAIL.PUSH_QUEUE. This procedures requires two input parameters:

Oracle HTML DB logs successfully submitted message in the table HTMLDB_MAIL_LOG with the timestamp reflecting your server's local time.

The most efficient approach to sending mail is to create a background job (or DBMS_JOB package) to periodically send all mail messages stored in the active mail queue.


See Also:

Oracle Database Administrator's Guide for more information managing job queues

The following example demonstrates the use of the HTMLDB_MAIL.PUSH_QUEUE procedure using a shell script. This example only applies to UNIX/LINUX installations. In this example, the SMTP gateway hostname is defined as smtp01.oracle.com and the SMTP gateway port number is 25.

SQLPLUS / <<EOF
EXEC FLOWS.HTMLDB_MAIL.PUSH_QUEUE('smtp01.oracle.com','25');
DISCONNECT
EXIT
EOF