Call (800) 766-1884 for Oracle support & training
Free Oracle Tips


Oracle Consulting Support
Oracle Upgrades
Use New Oracle Features
Oracle Replication Support
Oracle Training
Remote Oracle DBA
System Documentation
Oracle Tips
Oracle Performance
 

Free Oracle Tips


 

HTML Text

BC Oracle tuning

Oracle training

Oracle support

Remote Oracle

 

 

   
  Oracle Tips by Burleson

Lists of Values (LOV)

A LOV is a reusable list that can be built dynamically with a SQL select statement or with a static set of values typed in by the developer.  Examples of static LOVs are:

  • Gender: Male, Female

  • Days of Week: Monday, Tuesday, Wednesday, etc…

The values in dynamic LOV’s are populated using a SQL select statement such as:

select description d, manufacturer_id r
from   manufacturer
order by 1;
 

LOV’s can be used in forms, in tabular form columns, in reports using Display as Text based on LOV, and select lists.  More explanation on creating and using LOV’s is included later in this book.

Shortcuts

Shortcuts enable the creation of reusable HTML or PL/SQL code.  For an idea of how this is used, the select list in the Conditional Display region for a button is shown in Figure 6.10.  There is a button displayed after the select list followed by a list of items shown directly below the select list.  In the HTML DB development environment, this was done using a shortcut.  The name of the shortcut is then placed in the Post Element Text of the select list item.  This example shows that HTML DB is actually written in HTML DB. 

As an exercise to demonstrate how to create and use the developer’s own shortcut, a page item that displays a date page item will be created.  A link will be provided on the side of the page item that will allow the user to click on it and set the item to today’s date.

This is defined in the following four step process:

1.       Create a blank application page named Shortcuts.  In the Page Attributes, add the following text to the HTML Header section.  This is using the functions.js script provided as part of HTML DB.  It provides the source code for the setValue() function used later in the shortcut.  What is being accomplished here is borrowing some code provided with the installation of HTML DB.

<script src="#IMAGE_PREFIX#javascript/functions.js" type="text/javascript"></script>

2.       Create a shortcut from scratch by going to Shared Components àShortcuts.

  • On the Creation Method page, select From Scratch and click Next.

  • On the Shortcut Attributes page: 
     

  • Name: SET_TODAYS_DATE.

  • Type: PL/SQL Function Body.

  • Shortcut: Enter the text from below.  The file is in the Code Depot.
     

  • Click Create.

Not only is the setValue JavaScript function provided by HTML DB going to be used in this example, the above script references a gif image named r_blue_arrow.gif, which is provided with HTML DB.  Take note of the date format.  It is possible to change the date format to the developer’s preferred format.  Another thing that can be done is the use of a substitution string for the date format to keep the date format consistent throughout the application.  One such substitution string would be PICK_DATE_FORMAT_MASK.  If so, the statement would look something like this:

d := to_char( sysdate, :PICK_DATE_FORMAT_MASK ); 

         When using the PICK_DATE_FORMAT_MASK as mentioned above, the page item would be created as a Date Picker (with application format mask).
 

3.       Create an HTML region on the page and then a Date Picker on the page.  This way the formats will always stay consistent whether the Date Picker icon or the Shortcut icon is used.

4.       After the page item is created, edit the new page item and add the text SET_TODAYS_DATE to Post Element Text  (include the double quotes), as shown in Figure 6.11.

M      Be careful: Shortcuts are case-sensitive.  It is recommended that developers use the same case as the HTML DB development team, which is UPPERCASE.
 

Apply Changes to the page item and run the page.  It should look similar to Figure 6.12.  What has happened with the SET_TODAYS_DATE shortcut is HTML DB has executed the PL/SQL block and returned the following HTML code.

<a href="javascript:setValue('P2910_SHORTCUT_DATE','01/24/2006');">
<img src="/i/r_blue_arrow.gif" width="16" height="16"></a>

It is this HTML code that was rendered as the Post Element Text for the page item.  It creates an anchor tag and an image tag displaying a blue arrow.  Clicking on the blue arrow executes the JavaScript in the anchor tag.

The example above used the PICK_DATE_FORMAT_MASK substitution string.  This is a best practice method of keeping all dates consistent throughout an application.

This is not the extent of the usefulness of shortcuts.  The sample in Figure 6.10 is created with a shortcut that is an elaborate PL/SQL program returning a string of HTML source code.

Files

The files in this shared component are stored in the HTML DB repository.  From the repository, they can be referenced in HTML code as described below.

Cascading Style Sheets and Static Files from the information on JavaScript are covered in a later chapter of this book.

Images

Images can be stored in the HTML DB repository and rendered in an application page.  The process and explanation of adding an image to the repository follows:

1.       Navigate to the Shared Components page.

2.       Click on the Images link.

3.       Click on the Create button.

4.       On the Create Image page:

  • Application: Select the application this image will be used in.

There are two ways to add the image to the repository.  It can either be associated with an application or with the workspace.  Adding it to the workspace is done by selecting the No Application Associated option.  If the image is added to the workspace, it can be referenced by all applications in the workspace.  If it is added to a particular application, it can only be referenced by that application.

  • Upload New Image: Browse for the file name to upload.

  • Notes: Enter notes if desired.

  • Click Upload. 

5.       Upon completion, the program will return to the Images page showing a list of images in the repository.

Referencing Images

When images are referenced from the repository, it is done by using substitution strings.  The two options are:

  • #WORKSPACE_IMAGES#:  Use this substitution string if the image is either         associated with an application other than the developer’s own or associated with       the workspace using the No Application Associated option.

  • #APP_IMAGES#:  Use this substitution string if the image is loaded into the       repository and associated with the current application.

Examples

The image can be rendered into a region of type PL/SQL by adding the following code for the region source:

htp.img( '#WORKSPACE_IMAGES#EasyHTMLDB.gif' ); 

htp.img( '#APP_IMAGES#EasyHTMLDB.gif' ); 

To use a loaded image as the logo for the application, it can be set in the Application Attributes page as shown in Figure 6.13. 

There is additional information about working with images in a later section of this book.


The above book excerpt is from:

Easy HTML-DB Oracle Application Express

Create Dynamic Web Pages with OAE

ISBN 0-9761573-1-4   

Michael Cunningham & Kent Crotty

http://www.rampant-books.com/book_2005_2_html_db.htm

   
  
 

Oracle performance tuning software 
 
 
 
 

Oracle performance tuning book

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

   

Copyright © 1996 -  2011 by Burleson Enterprises. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.