Flex Your APEX Implementing Oracle E-Business Suite Descriptive Flexfields in Application Express...
-
Upload
hailee-milles -
Category
Documents
-
view
225 -
download
2
Transcript of Flex Your APEX Implementing Oracle E-Business Suite Descriptive Flexfields in Application Express...
Flex Your APEXImplementing Oracle E-Business SuiteDescriptive Flexfields in Application Express
Shane BentzInterVarsity Christian Fellowship/USA
2
Presentation Summary
• Descriptive Flexfield Introduction• General Overview of Method
• Page Items• Application-Level Processes and Item• Database Stored Functions• Javascript Code
• Label Template Specifications• Fetch and DML Processing• Potential Future Improvements
3
Descriptive Flexfield Introduction
• Descriptive flexfields provide a flexible way for Oracle Applications to provide customizable "spaces" within a page or pages of an application. (http://www.oracle.com/technology/tech/blaf/specs/flexfields.html)
• Generic columns (traditionally called attributes) have two general purposes:• potential future use• storing mutually exclusive data to conserve
space
4
Descriptive Flexfield Introduction
• A dedicated governing column (traditionally named ATTRIBUTE_CATEGORY) is used to define a context-sensitive purpose for these generic columns.Example: Payment Types
(Credit Card, Cash, E-Pay, etc.)
• Each generic attribute column can be assigned a validation rule called a value set.
5
Descriptive Flexfield Introduction
Necessary Rules (for this method):• Value sets assigned to attributes must have
a validation type of “Table”.• If an attribute column is defined as a free-
form text item, there should be no value set assigned to it.
6
General Overview
Application Express Items and Processes:• Multiple versions (Text Field, Select List, and
Pop-Up Key LOV) of ATTRIBUTE items on your Application Express page
• Two on-demand application-level processes and one application-level item
7
General Overview
Database and Javascript Code:• Two database functions to dynamically build
the valid list of options to be populated in select and pop-up lists
• Javascript to make everything appear magical• show/hide appropriate items• AJAX used to retrieve the validation lists• changing the label on each attribute field
• All code is provided in the presentation paper
8
Page Items
Create the following items:• an ATTRIBUTE_CATEGORY item which
governs which attribute items are displayed.• a Text Field, Select List, and Pop-Up Key LOV
“version” of each attribute database column• hidden items for each attribute to store the
value set ID if the attribute has a table-based value set and the help text retrieved from the flexfield definition
9
Page Items
Page items needing to be created:
10
Page Items (Pop-Up Key LOV)
Pop-Up Key LOV items should have the following characteristic:
• a List of Values source which calls a packaged function to dynamically build the validation list. Example:begin
return ( generate_attribute_lov ( :p6_attribute1_vset_id ) );
end;
11
Application-Level Processes
CREATE_DYNAMIC_LOV – generates XML of a list of valid options to be assigned to a select list
GET_ATTRIBUTES – generates XML to describe the needed attributes• the name of the attribute column• the attribute’s label• the value set ID of the value set for validation• flag indicating if the value set is a “long list”• help text stored in the “description” of the flexfield column• if fetching an existing record, the current value stored in
the attribute database column and its description
12
Application-Level Item
APPL_LEVEL_VSET_ID• accessed by the CREATE_DYNAMIC_LOV on-
demand application-level process to build the list of options of a select list.
• as the AJAX code loops through each attribute item, this item temporarily stores the value set ID of the attribute currently being processed.
13
Stored Functions
GENERATE_ATTRIBUTE_LOV• returns the SELECT statement representing the
value set associated with current attribute column to generate the list of options
• example: select description, code from master_lookup_table order by description;
GET_ATTRIBUTE_DESCRIPTION• returns the description of a code stored in an
attribute column
14
Javascript Code
• clearAllAttributes: sets the value of all attributes to null
• hideAllAttributes: turns display of all attribute items off
• ChangeLabel*: changes the label of an item on the page*requires a change to the specified label template
15
Javascript Code (AJAX)
• Asynchronous Javascript And XML• Application Express has built-in code which
makes implementing AJAX simple• on-demand application-level process and the
htmldb_Get Javascript function to call the on-demand application-level process
• lots of examples on the Oracle Application Express forum (http://forums.oracle.com/forums/forum.jspa?forumID=137)
16
Javascript Code (AJAX)
• fillAttributeLOV – dynamically builds a select list• getAttributeCategoryXML – main JS function
1. uses AJAX to retrieve several pieces of information (metadata) about the necessary attribute columns
2. loops through each attribute column’s metadata to1. determine which item type to use
2. build validation lists where appropriate
3. assign the attribute-specific help text to the item
4. change the label of the item dynamically
17
Label Template Specifications
For Javascript to dynamically change the label of an item, there are two requirements of the label template(s):
• the opening label tag must have an ID attribute for Javascript to access its contents• example: <label for=“first name” id=“fname_label”>
• the opening and closing label tags must be immediately “next to” the text of the label• example: … id=“fname_label”>First Name</label>
18
Label Template Specifications
Two required specifications to dynamically change the label:
19
Fetch and DML Processing
The SELECT “Before Header” process looks up the metadata description of the current record in order to know in which “version” of the attribute items to place the information.
The INSERT and UPDATE “After Submit” processes assume only the appropriate “version” of the attribute item will contain the current value.
It is important that only one “version” of the item contains the value.
20
Fetch and DML Processing
The INSERT and UPDATE “After Submit” processes assume only the appropriate “version” of the attribute item will contain the current value.
21
Potential Future Improvements
• Dynamically implement the “required” checkbox of an attribute column
• Addition of a “date picker” or other item types.• Dynamically create the items (using
APEX_ITEM) instead of hiding and showing “appropriate versions”.
22
Sources and Resources
• Oracle Application Express Home Pagehttp://www.oracle.com/technology/products/database/application_express/index.html
• Oracle Application Express Forumhttp://forums.oracle.com/forums/search.jspa?forumID=137
• Oracle E-Business Suite Documentationhttp://www.oracle.com/technology/tech/blaf/specs/flexfields.html
• Javascript Tutorialhttp://www.w3schools.com/js/default.asp
23
Contact Information
Shane BentzApplication Development Mgr.InterVarsity Christian Fellowship/USA6400 Schroeder RoadMadison, Wisconsin [email protected]
Copyright 2008