iSelfSchooling.com - Since 1999  References  |  Job Openings
    Home  | Search more  | Oracle Syntax  | Computer Institute   | (Login or Register to access to VIDEOS)
 

Copyright & User Agreement

   Suggestions Email2aFriendHomepage us! |  Bookmark

Services

  Vision/Mission

  Services

  Biography

  Contact Us

 FREE Training

  Start...

  SQL

  PL/SQL

  Forms 

  Reports

  DBA Fundamentals

  Performance

  Prepare for OCP

  ShareUrNotes

...

  Acknowledgement

  Who is who

  University Directory

  Links...

 

 

 

FREE Online Oracle Training for beginners and advanced - The most comprehensive Oracle tutorial

The authors do not guarantee or take any responsibility for the accuracy, or completeness of the information.

BASICS

SQL | PL/SQL

DEVELOPERS

FORMS 2 | REPORTS | Other TOOLS

DBAs

FUNDAMENTALS 2 | PERFORMANCE | OEM

ADVANCE

APPLICATION SERVER | GRID CONTROL | ARTICLES 2 3 4

Advanced - Articles II

Lesson 01 | Lesson 02 | Lesson 03 | Lesson 04 | Lesson 05 | Lesson 06 | Lesson 07 | Lesson 08 | Lesson 09 | Lesson 10 | Lesson 11 | Lesson 12 | Lesson 13 | Lesson 14 | Lesson 15 | Lesson 16 | Lesson 17 | Lesson 18 | Lesson 19 | Lesson 20 | Lesson 21 | Lesson 22 | Lesson 23 | Lesson 24 | Lesson 25 | Lesson 26 | Lesson 27 | Lesson 28 | Lesson 29 | Lesson 30 | Lesson 31 | Lesson 32 | Lesson 33 | Lesson 34 | Lesson 35 |

Lesson 30

"When you see your brother, you see God."

-St. Clement of Alexandria (c.A.D. 150-c.215)

How to populate poplist item?

Your client has a form that contains a product description. They don’t want that their data entry staffs to type a product description. You, as a programmer, have been asked to change their form so that the product description item is populated from the PRODUCT table. They therefore are able to select the product description. You need to change the “text item” object to the “list item” object with the item type as “poplist.”

 

Solution:

=========

Assuming that you have a form that has an item that contains the product description.

 

1-    Go to the object navigator window and open the “product description” property palette.

 

2-    Change “item type” to “list item.”

 

3-    Make sure that “list style” is “poplist.”

 

4-    Open the “Elements in list.” You do this just to avoid getting an error regarding with the “No value defined in the list item” error message. 

 

5-    Type “A” in “List Elements.”

 

6-    Type “A” in “List Item Value.”

 

7-    Close the “product description” property palette.

 

8- Create a record group and name it “rg_prod_desc” with the 

   following query:

(Make sure that the “Based on the query below” option is selected.)

 

   SELECT descrip A, descrip B 

     FROM product 

     ORDER BY 1  -- do not type “;” at the end.

 

Note that you must define the descrip column twice. The first one is for label, and the second one is for the value.

 

9-    Open the “rg_prod_desc” property palette and change the “Name” item and the “Record Group Fetch Size” item to your desire value.

For example:

Change “Name” to “rg_prod_desc.”

Change “Record Group Fetch Size” to 10.

 

10-Close the property palette. 

 

11- Create the “WHEN_NEW_FORM_INSTANCE” trigger with the following code:

 

DECLARE 

   STATUS NUMBER;

   Problem EXCEPTION;

 

BEGIN

 

   -- to populate the group

      STATUS:=POPULATE_GROUP('RG_PROD_DESC');

 

  -- Check that the select statement was executed successfully.

 

    IF STATUS <> 0 THEN

       RAISE problem;

    ELSE

       -- to populate the list item

       POPULATE_LIST('DESCRIP', 'RG_PROD_DESC');

    END IF;

 

EXCEPTION

      WHEN problem THEN

         MESSGAE ('We have a problem to query the PRODUCT table.');

END;

 

12- Compile and close the trigger.

 

13- Run the form, go to the product description item, and click on the description poplist. You should see the items listed.

 

 

 
 
Google
 
Web web site