Skip Headers
Oracle® Fusion Applications Developer's Guide
11g Release 1 (11.1.3)

Part Number E15524-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

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

23 Using Descriptive Flexfields

This chapter discusses how to use descriptive flexfields to enable customers to add additional attributes to business objects in their Oracle Fusion applications.

This chapter includes the following sections:

23.1 Introduction to Descriptive Flexfields

Descriptive flexfields provide a way for implementors at customer sites to add custom attributes to entities, and to define validation and display properties for them. A descriptive flexfield is a logical grouping of segments that is mapped to a set of database columns that serve as placeholders for custom attributes. These placeholder columns are often referred to as extension columns. The attributes in the group are of three types: global segments, context-sensitive segments, and context segments. The global segments are for custom attributes that apply to all entity rows, while the context-sensitive segments are for custom attributes that apply to certain entity rows based on the value of a context segment.

To learn more about flexfield basics and terms, including developer and implementor roles, global segments, context-sensitive segments, and context segments, see Chapter 22, "Getting Started with Flexfields."

As the developer, you can define multiple usages for a descriptive flexfield. For example, you might have defined an address flexfield that the implementor may use to add attributes related to addresses. The implementor can define context-sensitive segments for the address that are based on a certain attribute, such as country code. You can reuse the address flexfield with any table for which you need address information, and the implementor needs to configure the flexfield only once.

To learn more about developer and implementor roles, see Section 22.2, "Participant Roles". To learn how implementors configure descriptive flexfields to meet customer's needs, see the "Using Flexfields for Custom Attributes" chapter in the Oracle Fusion Applications Extensibility Guide.

To complete the development tasks for descriptive flexfields:

  1. Create the extension columns to store the flexfield data, and then register the flexfield definition, usage, and parameter metadata.

    See Section 23.2, "Developing Descriptive Flexfields".

  2. Create descriptive flexfield business components.

    See Section 23.3, "Creating Descriptive Flexfield Business Components".

    Tip:

    After completing this step, you can regenerate the flexfield business components programmatically at runtime to update your descriptive flexfield implementation without manual intervention.

    For more information, see Section 26.4, "Regenerating Flexfield Business Components Programmatically".

  3. Create view links between the descriptive flexfield business components and the application's business components.

    See Section 23.4, "Creating Descriptive Flexfield View Links".

  4. Nest the descriptive flexfield application module instance in the application module.

    See Section 23.5, "Nesting the Descriptive Flexfield Application Module Instance in the Application Module".

  5. Add an instance of the descriptive flexfield view object to the application module.

    See Section 23.6, "Adding a Descriptive Flexfield View Object to the Application Module".

  6. Add the descriptive flexfield usage to the appropriate application pages.

    See Section 23.7, "Adding Descriptive Flexfield UI Components to a Page".

  7. Configure the descriptive flexfield UI components.

    See Section 23.8, "Configuring Descriptive Flexfield UI Components".

  8. Load any necessary application seed data, such as error messages or lookup values.

    See Section 23.9, "Loading Seed Data."

After implementing a flexfield, you can define seed or test value sets for the flexfield, and you can create a model that you can use to test it. For more information, see Section 26.1.2, "How to Test Flexfields."

After you have completed the flexfield development process and delivered your application, implementors can use the Manage Descriptive Flexfields task flows to define context values and to configure the segments for each flexfield. These task flows determine how the flexfield's segments will be populated, organized, and made available to end users within the application. For information about planning and implementing flexfield configuration, such as defining attributes, labels, behavior, and associated value sets, see the "Using Flexfields for Custom Attributes" chapter in the Oracle Fusion Applications Extensibility Guide.

To make the Manage Descriptive Flexfields task flows available to implementors, register them with the Oracle Fusion Functional Setup Manager. For more information, see Section 26.5, "Integrating Flexfield Task Flows into Oracle Fusion Functional Setup Manager".

23.1.1 Benefits of Descriptive Flexfields

Descriptive flexfields let you satisfy different customers without having to reprogram the application, by enabling the customers to add customized fields. Descriptive flexfields also enable context-sensitive fields that appear only when needed. In essence, a descriptive flexfield enables implementors to extend the data model without writing either XML or Java. A descriptive flexfield is presented as a set of fields on a page, much like the fields of the core application.

For example, consider a retail application that keeps track of customers. The customer form would typically include fields such as Name, Address, State, Customer Number, and so on. However, the page might not include fields to keep track of customer clothing size and color preferences, because these are attributes that can differ for each company that uses the application. For example, if the retail application is used for a tool company, a field for clothing size would be undesirable. Even if you initially provide all the fields that a company needs, the company might later identify even more customer attributes that it wants to track. You can add a descriptive flexfield to the customer form to provide the desired expansion space. Companies also can take advantage of the fact that descriptive flexfields can be context-sensitive, where the information that the application stores depends on other values that the end users enter on other parts of the page. For example, a company could configure the descriptive flexfield for a fixed asset form to store style, size, and wood type if the asset type was "desk", and store CPU chip and memory size if the asset type was "computer."

Another example is the descriptive flexfield in the Oracle General Ledger journal entry form. Implementors can configure the flexfield to add information of a customer's own choosing. For example, a customer might want to capture additional information about each journal entry, such as source document number, or the name of the person who prepared the entry.

To maximize flexibility for customers, consider defining a descriptive flexfield for every entity in your application to which a customer might need to add attributes.

23.1.2 How Descriptive Flexfields Are Modeled in Oracle Application Development Framework

Flexfields are modeled as a collection of Oracle Application Development Framework (Oracle ADF) polymorphic view rows, as described in the "Working with Polymorphic View Rows" section in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework. In a polymorphic collection of rows, each view row can have its own set of attributes, and all rows have at least one common attribute, the discriminator. The discriminator determines which view row type should be used. Given a collection of polymorphic view rows, each row can be a different type.

The attribute sets that are associated with the discriminator are predefined. In fact, Oracle ADF enables each view row to have its own view definition. When a polymorphic collection of rows is created, Oracle ADF selects a view definition for the row to be added based on the value of the discriminator attribute.

Descriptive flexfield segments are exposed as view row attributes in the order that they are defined in the flexfield's metadata. Global segments are exposed as attributes in the base view object of the polymorphic collection. Every context is modeled as an extended view object of the base view object. That is, an extended view object is created for every context value. These extended view objects, which are referred to as subtype view objects, expose context-sensitive segments as subtype-specific view attributes. The context segment is exposed as the discriminator attribute of the polymorphic view rows.

You use a wizard to generate a polymorphic base view object that is based on the descriptive flexfield definition, then create a view link to connect the product view object and the base view object. You can then use the base view object to add the flexfield to a UI page. For more information about the generation of base and subtype view objects, see Section 23.3, "Creating Descriptive Flexfield Business Components."

Note:

One distinction of the flexfield context-switching mechanism is that during context switching, the context-sensitive segments are initialized as follows:

  • If a segment is defined to use a constant value from an underlying entity object as its default, it is initialized to that value.

  • If a segment is defined to use a descriptive flexfield parameter by default, it is initialized to that value.

  • For all other cases, the context-sensitive segment is set to NULL.

For more information about polymorphic view rows, see the "Working with Polymorphic View Rows" section in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

Note:

Because flexfield view objects are modeled as polymorphic view objects, you can use descriptive flexfield view objects in the same manner that you use any other polymorphic view objects, and they will behave in the same way. This includes support for flexfields in ADF Desktop Integration. For more information, see Section 23.14, "Accessing Descriptive Flexfields from an ADF Desktop Integration Excel Workbook" and the Oracle Fusion Middleware Desktop Integration Developer's Guide for Oracle Application Development Framework.

23.2 Developing Descriptive Flexfields

Whenever you have a product table that you think implementors might need to extend for their specific circumstances, you can add columns to the table and register those columns as flexfield segments. After you have registered a flexfield, you can reuse the flexfield with other product tables.

To complete the process for developing a descriptive flexfield:

  1. Add extension columns to the product table.

  2. Register the flexfield and define its metadata and master usage. You can register the flexfield using a registration task or using procedures from the FND_FLEX_DF_SETUP_APIS PL/SQL package.

  3. Optionally reuse the flexfield by adding the same set of extension columns to other product tables.

  4. Register all secondary usages using either a registration task or procedures from the FND_FLEX_DF_SETUP_APIS PL/SQL package.

  5. Register the entity details for each usage.

  6. Register flexfield parameters to identify values that are obtained from external reference data sources, such as different database columns, constant values, or session attributes. You can register the parameters using a registration task or using the procedures from the FND_FLEX_DF_SETUP_APIS PL/SQL package.

23.2.1 How to Create Descriptive Flexfield Columns

To implement a descriptive flexfield for a product table, you first add extension columns to that table. You need to add a context column, such as ATTRIBUTE_CATEGORY, and as many generic attribute (segment) columns of each type, such as ATTRIBUTE1_VARCHAR2 and ATTRIBUTE12_NUMBER, that you think the implementors will need. A segment column must be a VARCHAR2, NUMBER, DATE, or TIMESTAMP. When defining a flexfield attribute, the implementor must map the attribute to an available extension column.

Tip:

There are no constraints on how to name the segment columns. However, these columns are typically named using the patterns ATTRIBUTEn_VARCHAR2, ATTRIBUTEn_NUMBER, ATTRIBUTEn_DATE, and ATTRIBUTEn_TIMESTAMP. This convention makes it easy to identify the flexfield segments. It also makes it easier to name the columns for other usages of the flexfield.

The context column, which is required, must be of type VARCHAR2. The context column's length determines the maximum length of the context codes that can be created by implementors when they configure the flexfields.

Each implementor can configure as many of the segment columns as the end user requires and can choose whether to use the context column.

You must use the Database Schema Deployment Framework tools to create the product table and columns. Using these tools ensures that the table and its columns are registered in the Oracle Fusion Middleware Extensions for Applications (Applications Core) data dictionary. For more information, see Chapter 57, "Using the Database Schema Deployment Framework."

23.2.2 How to Register and Define Descriptive Flexfields

Before you can create business components for a descriptive flexfield, you must first define and register the descriptive flexfield.

The basic steps for defining and registering a descriptive flexfield are as follows:

  • Name and describe the flexfield.

  • Define the master usage. The master usage is the first usage that you define for a flexfield.

  • Define the product table column to be used for the context segment. The product table that is used for the first usage that you register is called the primary table.

  • Map the product table columns to the flexfield segments.

You can define a descriptive flexfield using a registration task, which you access from the Oracle Fusion Applications Setup and Maintenance work area, or using the FND_FLEX_DF_SETUP_APIS PL/SQL package.

23.2.2.1 Registering and Defining Descriptive Flexfields Using a Registration Task

You can use the Register Descriptive Flexfields task, which is accessed from the Oracle Fusion Applications Setup and Maintenance work area, to register and define a descriptive flexfield. First you add a descriptive flexfield entry, then you define the master usage. You next specify which primary table column to use for the context segment, and you define the primary table columns to be used for the flexfield segments. You can then specify the name of the entity object, the package name, and the prefix to use when generating the flexfield's business components, or you can complete that task at a later time.

Tip:

You can also define and register a flexfield using the FND_FLEX_DF_SETUP_APIS PL/SQL package, as described in Section 23.2.2.2, "Registering and Defining Descriptive Flexfields Using the Setup APIs.".

Before you begin: 

Create the extension columns as described in Section 23.2.1, "How to Create Descriptive Flexfield Columns."

To register and define a descriptive flexfield using a registration task: 

  1. In the Oracle Fusion Applications global area, choose Setup and Maintenance from the Administration menu.

  2. Go to the Register Descriptive Flexfields task.

  3. From the Search Results section, select Actions > New.

  4. On the Create Descriptive Flexfield page shown in Figure 23-1, set the following values:

    • Descriptive Flexfield Code: Provide a code that uniquely identifies the flexfield.

    • Descriptive Flexfield Name: Provide a descriptive name for the flexfield.

    • Description: Provide a short description of the flexfield.

    • Application Name: Select the application name that has been assigned for the product area.

    • Module: Select the module that owns the flexfield. This is typically the application or logical business area (LBA) with which the flexfield is delivered.

    • Delimiter: Select the character to be displayed between flexfield segments, when the segments are displayed in a concatenated format.

    Figure 23-1 Create Descriptive Flexfield Page

    Create Descriptive Flexfield page
  5. Click Save and Close.

  6. In the Search Results section, select the flexfield that you just created and click Primary Table.

  7. In the Descriptive Flexfield Table section of the Manage Flexfield Primary Table and Columns page, choose Actions > New.

  8. On the Create Table Usage page shown in Figure 23-2, set the following values to define the master usage for the flexfield:

    • Table Usage Code: Provide a code that uniquely identifies the flexfield usage. For the master usage, this is typically the same code as the flexfield code.

    • Table Name: Enter or select the name of the database table that contains the columns to be used as flexfield segments.

    • Description: Provide a short description of the flexfield usage.

    Figure 23-2 Create Table Usage Page

    Create Table Usage page
  9. Click Save and Close.

  10. In the Table Name Column Details tab, choose Actions > New.

  11. Select Context Segment from the Column Usage Type dropdown list.

  12. From the Column Name dropdown list, select the database column that you want to map to the flexfield's context segment. The column must be of type VARCHAR2.

    Tip:

    The context segment database column is typically named ATTRIBUTE_CATEGORY.

  13. Repeat the following steps for each table column that you want to map to a flexfield segment, as shown in Figure 23-3:

    1. In the Column Details tab, choose Actions > New.

    2. Select Segment from the Column Usage Type dropdown list.

    3. Select the database column from the Column Name dropdown list that you want to map to a segment of the flexfield.

    Figure 23-3 Column Details Tab

    Column details tab
  14. Click Save and Close.

  15. You can register the entity details now or later. However, this step must be completed before you can generate the flexfield usage's business components. For more information, see Section 23.2.5, "How to Register Entity Details."

  16. (Optionally) Register secondary usages of the flexfield as described in Section 23.2.4, "How to Register the Reuse of a Descriptive Flexfield."

23.2.2.2 Registering and Defining Descriptive Flexfields Using the Setup APIs

In addition to using a registration task, as described in Section 23.2.2.1, "Registering and Defining Descriptive Flexfields Using a Registration Task," you can define and register a descriptive flexfield using procedures from the FND_FLEX_DF_SETUP_APIS PL/SQL package. This package also has procedures for updating, deleting, and querying flexfield definitions.

To learn how to access documentation about using the FND_FLEX_DF_SETUP_APIS PL/SQL package, see Section 23.2.2.2.1, "What You May Need to Know About the Descriptive Flexfield Setup API."

Before you begin: 

Create the extension columns as described in Section 23.2.1, "How to Create Descriptive Flexfield Columns".

To register and define a descriptive flexfield using the setup APIs: 

  1. Run the fnd_flex_df_setup_apis.create_flexfield(...) procedure to register the descriptive flexfield, its context segment, and its master usage.

  2. Run the fnd_flex_df_setup_apis.create_segment_column_usage(...) procedure for each segment column to register the segment columns.

  3. (Optionally) Register the entity details as described in Section 23.2.5, "How to Register Entity Details." This step must be completed before you can generate the flexfield usage's business components.

23.2.2.2.1 What You May Need to Know About the Descriptive Flexfield Setup API

In the descriptive flexfield development process, use the FND_FLEX_DF_SETUP_APIS PL/SQL package to manage flexfield registration metadata.

You can learn about the FND_FLEX_DF_SETUP_APIS PL/SQL package by running the following command, which stores package documentation and usage examples in the <db_name>_<user_name>_FND_FLEX_DF_SETUP_APIS_<date>.plsqldoc file.

sqlplus <fusion_user>/<fusion_pwd>@<fusion_db> \
@/ORACLE/fusionapps/atgpf/applcore/db/sql/flex/fnd_flex_pkg_doc.sql \ 
FND_FLEX_DF_SETUP_APIS 

23.2.3 How to Reuse a Descriptive Flexfield on Another Table

A descriptive flexfield configuration can be shared with other product tables. To reuse a descriptive flexfield, you add the same set of extension columns to the product table for which you want to reuse the flexfield, and you register the secondary usage as described in Section 23.2.4, "How to Register the Reuse of a Descriptive Flexfield."

The product table that was used to first register the flexfield is referred to as the primary table, and it is the owner of the flexfield. A reuse of a flexfield is referred to as a secondary usage.

The secondary table must have the same number of extension columns as the primary table. The secondary extension columns must have the same data type and size as the corresponding primary table extension columns.

The column names must also be exactly the same as in the primary table, with the exception of an optional prefix. For example, if the column names are ATTRIBUTE1 and ATTRIBUTE2 in the primary table, then in the secondary table they could again be ATTRIBUTE1 and ATTRIBUTE2, respectively, or with a prefix, they could be HOME_ATTRIBUTE1 and HOME_ATTRIBUTE2. They cannot be ATTR1 and HOME_ATTR2, or any variation that does not end in the names of the primary table columns.

Each implementor can configure as many of the segment columns as the end user requires and can choose whether to use the context column.

You must use the Database Schema Deployment Framework tools to create the product table and columns. Using these tools ensures that the table and its columns are registered in the Oracle Fusion Middleware Extensions for Applications (Applications Core) data dictionary. For more information, see Chapter 57, "Using the Database Schema Deployment Framework."

23.2.4 How to Register the Reuse of a Descriptive Flexfield

After you add extension columns to a table for a secondary usage of a flexfield, you must register the usage before you can build a descriptive business component for the secondary usage.

You can register the secondary usage of a descriptive flexfield using a registration task or using procedures from the FND_FLEX_DF_SETUP_APIS PL/SQL package.

23.2.4.1 Registering the Secondary Usage of a Descriptive Flexfield Using a Registration Task

You can use the Register Descriptive Flexfields task, which is accessed from the Oracle Fusion Applications Setup and Maintenance work area, to register the secondary usage of a descriptive flexfield. The registration task uses the master usage column mappings to determine how to map the secondary table's column names to the flexfield segments. If you specify a prefix, the task uses the prefix to determine the column mappings. For example, if the primary table's ATTRIBUTE1 column is mapped to a segment, and you specify a prefix of HOME for the secondary usage, the task automatically maps its HOME_ATTRIBUTE1 column to a flexfield segment.

Tip:

You can also register the secondary usage of a flexfield using the FND_FLEX_DF_SETUP_APIS PL/SQL package, as described in Section 23.2.4.2, "Registering the Secondary Usage of a Descriptive Flexfield Using the Setup APIs.".

Before you begin: 

  1. Register the descriptive flexfield and its master usage as described in Section 23.2.2, "How to Register and Define Descriptive Flexfields."

  2. Create the extension columns for the secondary usage as described in Section 23.2.3, "How to Reuse a Descriptive Flexfield on Another Table."

To register a secondary usage using a registration task: 

  1. In the Oracle Fusion Applications global area, choose Setup and Maintenance from the Administration menu.

  2. Go to the Register Descriptive Flexfields task.

  3. In the Search Results section, select the flexfield for which you want to add a secondary usage and click Secondary Tables.

  4. In the Descriptive Flexfield Table section of the Manage Flexfield Secondary Tables and Columns page, choose Actions > New.

  5. On the Create Table Usage page, set the following values to define the secondary table usage for the flexfield:

    • Table Usage Code: Provide a code that uniquely identifies the flexfield usage.

    • Table Name: Select the name of the database table that contains the columns to be used as flexfield segments for this secondary usage.

    • Column Name Prefix: If you used a prefix for the flexfield column names, enter the prefix.

    • Description: Provide a short description of the flexfield usage.

  6. Click Save and Close.

  7. You can register the entity details now or later. However, this step must be completed before you can generate the flexfield usage's business components. For more information, see Section 23.2.5, "How to Register Entity Details."

23.2.4.2 Registering the Secondary Usage of a Descriptive Flexfield Using the Setup APIs

In addition to using the registration task, as described in Section 23.2.4.1, "Registering the Secondary Usage of a Descriptive Flexfield Using a Registration Task," you can define and register the secondary usage of a descriptive flexfield using procedures from the FND_FLEX_DF_SETUP_APIS PL/SQL package.

To learn how to generate documentation about using the FND_FLEX_DF_SETUP_APIS PL/SQL package, see Section 23.2.2.2.1, "What You May Need to Know About the Descriptive Flexfield Setup API."

The definition of a descriptive flexfield usage includes the following information:

  • The table name

  • The code for identifying the secondary usage

  • The column name prefix. For example, if the primary table column is ATTRIBUTE1, and the secondary table column is HOME_ATTRIBUTE1, then the prefix is HOME_.

Before you begin: 

  1. Register the descriptive flexfield and its master usage as described in Section 23.2.2, "How to Register and Define Descriptive Flexfields."

  2. Create the extension columns for the secondary usage as described in Section 23.2.3, "How to Reuse a Descriptive Flexfield on Another Table."

To register a secondary usage using the setup APIs: 

  1. To register the secondary usage of a descriptive flexfield, run the fnd_flex_df_setup_apis.create_flex_table_usage(...)procedure.

  2. (Optionally) Register the entity details as described in Section 23.2.5, "How to Register Entity Details." This step must be completed before you can generate the flexfield usage's business components.

23.2.5 How to Register Entity Details

Before you can create a flexfield business component and create a flexfield business component and create flexfield-specific application module instances, you must register the following information:

  • The full class name of the entity object for the table upon which the flexfield usage is based.

  • A prefix from which to derive the names of generated objects.

  • The package in which to place the generated business components. Each usage can have its own package name.

You can use a registration task or the FND_FLEX_DF_SETUP_APIS PL/SQL package to register this information for a flexfield usage.

23.2.5.1 Registering Entity Details Using a Registration Task

You can use the Register Descriptive Flexfields task, which is accessed from the Oracle Fusion Applications Setup and Maintenance work area, to register a flexfield usage's entity details.

Tip:

You can also register entity details using the FND_FLEX_DF_SETUP_APIS PL/SQL package, as described in Section 23.2.4.2, "Registering the Secondary Usage of a Descriptive Flexfield Using the Setup APIs."

Before you begin: 

  1. Register the usage as described in Section 23.2.2, "How to Register and Define Descriptive Flexfields" and Section 23.2.4, "How to Register the Reuse of a Descriptive Flexfield."

  2. Ensure that the entity object for the usage's table exists.

To register the entity details using a registration task: 

  1. In the Oracle Fusion Applications global area, choose Setup and Maintenance from the Administration menu.

  2. Go to the Register Descriptive Flexfields task.

  3. In the Search Results section, select the flexfield for which you want to add entity details and click Primary Table for the master usage or click Secondary Tables for a secondary usage.

  4. Select the usage and click the Table Name Entity Details tab, as shown in Figure 23-4.

    Figure 23-4 Entity Details Tab

    Entity Details tab
  5. If no row exists in the Entity Details section, choose Actions > New to create a row.

  6. Set the following values:

    • Entity Object: Provide the full class name of the table's entity object.

    • Object Name Prefix: Enter a short unique name for the flexfield usage. For example PartsDFF. This prefix is used to derive the names of objects that are generated for the flexfield usage.

    • Package Name: Specify the name of the root package to be used for the generated business components that model the flexfield usage.

      Note:

      Each usage must have a unique package name. In addition, the package name must uniquely identify a usage. For example, if the root package for a usage is oracle.apps.hcm.payroll.flex.dff1, then you cannot define the oracle.apps.hcm.payroll.flex package for another usage, because that package would then identify both usages. Instead, you could use oracle.apps.hcm.payroll.flex.dff2.

  7. Click Save and Close.

23.2.5.2 Registering Entity Details Using the Setup APIs

In addition to using the registration task, as described in Section 23.2.5.1, "Registering Entity Details Using a Registration Task," you can register entity details using procedures from the FND_FLEX_DF_SETUP_APIS PL/SQL package.

To learn how to generate documentation about using the FND_FLEX_DF_SETUP_APIS PL/SQL package, see Section 23.2.2.2.1, "What You May Need to Know About the Descriptive Flexfield Setup API."

Before you begin: 

  1. Register the usage as described in Section 23.2.2, "How to Register and Define Descriptive Flexfields" and Section 23.2.4, "How to Register the Reuse of a Descriptive Flexfield."

  2. Ensure that the entity object for the usage's table exists.

To register the entity details using the setup APIs: 

  • Run the fnd_flex_df_setup_apis.create_adfbc_usage(...)procedure to register the entity object, package name, and object name prefix for the flexfield usage.

23.2.6 How to Register Descriptive Flexfield Parameters

A flexfield parameter is a declared public variable, which can be used to designate which attributes of eligible entity objects that are related to the flexfield can be used to pass external reference data to flexfield segments. These entity object attributes could, in turn, take their values from column values, constant values, session attributes, and so forth.

A flexfield may have zero, one, or many flexfield parameters defined, each one representing a specific type of information that is useful to that flexfield. Implementors can use the parameters to define defaults and value set validation for the flexfield segments.

Some or all of these types of data sources can be referenced in the following ways:

  • At row creation time to provide default segment values.

  • In derived segments, which are global, context, or context-sensitive segments for which values are derived from an external reference data source, causing its values to automatically change to reflect any new reference data values.

  • In the WHERE clauses for table value sets. For more information, see the "Creating Custom Value Sets" section in the Oracle Fusion Applications Extensibility Guide.

Note:

Although a flexfield parameter is associated with a flexfield in metadata, it is not connected with any specific segment in the flexfield. Rather, it serves as a variable through which flexfield segments can access reference data from other sources.

Every flexfield parameter must be mapped to an appropriate entity object attribute at design time. In this way, implementors are guaranteed that the parameters will always be mapped to entity object attributes, and they can use the parameters as needed.

When you create business components for a descriptive flexfield, you will be required to map each parameter associated with that flexfield to an attribute of the entity object that you are creating. The values accessed from reference data sources by these parameters are then available for you to use in your application. Many of the core (nonflexfield) fields on a page can serve as reference fields.

Consider the example of an Expense Lines entity object with the core fields of Expense Line ID, Expense Date, Amount, Description, and Expense Type. If the flexfield has an ExpenseType parameter that is mapped to the Expense Type field, an implementor can configure the context segment to derive its value from the ExpenseType parameter.

To implement descriptive flexfield parameters, you must map them to the appropriate entity object attributes at design time and configure them. For more information, see Section 23.3, "Creating Descriptive Flexfield Business Components" and Section 23.8.3, "How to Configure Descriptive Flexfield Parameters".

23.2.6.1 Registering a Flexfield Parameter Using a Registration Task

You can use the Register Descriptive Flexfields task, which is accessed from the Oracle Fusion Applications Setup and Maintenance work area, to register a flexfield parameter.

Tip:

You can also register parameters using the FND_FLEX_DF_SETUP_APIS PL/SQL package, as described in Section 23.2.6.1, "Registering a Flexfield Parameter Using a Registration Task."

To register a parameter using a registration task: 

  1. In the Oracle Fusion Applications global area, choose Setup and Maintenance from the Administration menu.

  2. Go to the Register Descriptive Flexfields task.

  3. In the Search Results section, select the flexfield for which you want to add a parameter and click Parameters.

  4. In the Parameters section of the Manage Flexfield Parameters page, choose Actions > New.

  5. In the Parameters section shown in Figure 23-5, set the following values to define a parameter for the flexfield:

    • Parameter Code: Provide a code that uniquely identifies the parameter for the given flexfield.

    • Description: Provide a brief description of the parameter.

    • Enabled: Select this checkbox.

    Figure 23-5 Manage Descriptive Flexfield Parameters Page

    Manage Descriptive Flexfield Parameters page
  6. Click Save and Close.

23.2.6.2 Registering a Flexfield Parameter Using the Setup APIs

In addition to using the registration task, as described in Section 23.2.6.1, "Registering a Flexfield Parameter Using a Registration Task," you can register a flexfield parameter using procedures from the FND_FLEX_DF_SETUP_APIS PL/SQL package.

To learn how to generate documentation about using the FND_FLEX_DF_SETUP_APIS PL/SQL package, see Section 23.2.2.2.1, "What You May Need to Know About the Descriptive Flexfield Setup API."

Before you begin: 

Define and register the flexfield as described in Section 23.2.2, "How to Register and Define Descriptive Flexfields."

To create a parameter using the setup APIs: 

  • Run the fnd_flex_df_setup_apis.create_parameter(...) procedure and provide a parameter code and data type.

23.3 Creating Descriptive Flexfield Business Components

Before you can use a descriptive flexfield in your application, you must use the Create Flexfield Business Components wizard to generate flexfield business components for the flexfield. The wizard generates a base view object that is based on the information in the flexfield metadata. After the initial flexfield registration, and before any configuration is completed, the base view object has at least two attributes: the primary key attribute, which links the flexfield view object to the product view object, and the context attribute, which serves as the discriminator.

When implementors configure the flexfields by defining global and context-sensitive segments, the base view object is regenerated and additional flexfield view objects are generated. Figure 23-6 shows an example of the configured ADF Business Components. The product view object contains only the nonflexfield attributes. The base view object contains the primary key attribute, the context attribute, and global attributes. The base view object is extended to define view object rows based on the configured context values. Each context value requires a subtype view object definition that represents the structure of the rows with that context value, as described in Section 23.1.2, "How Descriptive Flexfields Are Modeled in Oracle Application Development Framework."

Figure 23-6 Descriptive Flexfield Modeled as ADF Business Components Component

Descriptive flexfield modeled as ADF Business Components

Note:

The product view object might contain other attributes. However, the product view object must not include flexfield view object attributes.

None of the flexfield view objects contains the fixed (nonflexfield) columns.

No Java implementation classes are generated for descriptive flexfield view objects. The product view object may or may not have Java implementation classes.

23.3.1 How to Create Descriptive Flexfield Business Components

You use the Create Flexfield Business Components wizard to create the flexfield business components for a flexfield's usage.

The business components generated will replace any existing ones that are based on the same flexfield usage.

Before you begin:

  • Ensure that you have added the Applications Core library to your project as described in Chapter 3, "Setting Up Your JDeveloper Workspace and Projects"

  • Ensure that at least one customization class is included in the adf-config.xml file. This inclusion serves to ensure correct application behavior. It does not matter which customization class you include.

    For information about customization layers, see the "Understanding Customization Layers" section in the Oracle Fusion Applications Extensibility Guide.

  • Verify that the entity object that will be used as the data source for the business component meets the following requirements:

    • All flexfield columns are included in the entity object. In general, all columns should be included.

    • A primary key is defined for the entity object. If an entity object is going to be used to create new application transaction rows, a default primary key must be programmed.

    • All VARCHAR2 columns used for descriptive flexfield attributes are mapped to data type java.lang.String.

    • All number columns used for descriptive flexfield attributes are mapped to data type java.math.BigDecimal.

    • All date columns used for descriptive flexfield attributes are mapped to data type java.sql.Date.

    • All timestamp columns used for descriptive flexfield attributes are mapped to data type java.sql.Timestamp.

  • Register the flexfield usage's entity object, package name, and object name prefix. For more information, see Section 23.2.5, "How to Register Entity Details."

To create descriptive flexfield business components:

  1. Build your project to ensure that the entity objects are available in classes. The modeler relies on what is in your classes.

  2. From the File menu, choose New.

  3. In the New Gallery, go to Business Tier > ADF Business Components and select Flexfield Business Components.

  4. Click OK.

  5. On the Role page of the Create Flexfield Business Components wizard, select the role that you want while you create the flexfield business components:

    • Developer: Select this role if you are incorporating the flexfield into an application. The business components must be stored in one of your projects. Select the desired project location from the Project Source Path dropdown list.

    • Tester: Select this role if you are planning to test your flexfield or a shared flexfield. In the Output Directory field, specify the path of your desired location for the generated business components.

      For more information about testing flexfields and importing shared flexfields, see Chapter 26, "Testing and Deploying Flexfields."

    Note:

    The role referred to here is not a role in the security sense. It exists only during this procedure, for the purpose of specifying where your generated flexfield business components should be stored.

  6. Click Next. The Flexfield page appears, as shown in Figure 23-7.

    Figure 23-7 Create Flexfield Business Components Wizard — Flexfield Page

    Business Components wizard - Flexfield page
  7. From the Type dropdown list, select Descriptive.

  8. In the Application field, specify the full name of the application to which your descriptive flexfield belongs.

    You can browse for the name, and filter by ID, Short Name, or Name.

  9. In the Code field, specify the code of the descriptive flexfield you want to use.

    You can browse for and filter by Code.

  10. In the Usage section, select the table row that contains your desired descriptive flexfield usage. The descriptive flexfield usage can be one of two possible types:

    • The master usage of the descriptive flexfield on the product table where it was originally defined. Every descriptive flexfield has one master usage.

    • A secondary usage of the descriptive flexfield on a product table, including the one on which it was originally defined. Zero or more secondary usage instances can be defined for a given flexfield, each one potentially on a different product table. You can identify secondary usage instances by the presence of the prefix (Reuse) in the Description field.

  11. Click Next.

  12. On the Entity Object page, expand the tree of available models and select an entity object to use as the data source for the descriptive flexfield, as shown in Figure 23-8.

    Figure 23-8 Create Flexfield Business Components Wizard — Entity Object Page

    Business Components wizard - Entity Object page

    The entity object you select must include all of the attributes representing the columns that are reserved for the descriptive flexfield.

    Descriptive flexfield attributes will be validated by the entity object along with its other attributes.

  13. If you want to select an entity object for which the descriptive flexfield attributes are defined as transient (not based on database table columns), then select the checkbox labeled Use the entity attributes named after their corresponding flexfield database columns. This checkbox is not selected by default.

    When an attribute of a descriptive flexfield entity object is transient, there is no matching underlying column name. When you select this checkbox, the system will match the entity object attribute names to the descriptive flexfield column names, and use the matching attributes to access the flexfield data. Ensure that the entity object has a full set of attributes with matching names before you select this option.

    This entity object must be registered under the master usage. There is no need to register another table for this purpose, even if the entity object is based on some other table. For more information, see Section 23.2.5, "How to Register Entity Details."

    Note:

    If the entity object with transient descriptive flexfield attributes is not based on the master usage, the transient attributes must be named using the same prefix as the other attributes of that entity object (and the corresponding table columns). For more information, see Section 23.2.3, "How to Reuse a Descriptive Flexfield on Another Table."

    Caution:

    The Create Flexfield Business Components wizard is case-sensitive. All column names — and the names of the flexfield entity object attributes associated with them — must be uppercase.

  14. Click Next.

  15. The Naming page displays the entity object's package name and object name that you registered for the usage, as described in Section 23.2.5, "How to Register Entity Details." Click Next.

    If the selected entity object is not registered with the flexfield usage, the Naming page displays a message to that effect. Take one of the following actions:

    • Click Back to return to the Entity Object page and select an entity object that has been properly registered.

    • Click Cancel to exit this wizard and register the entity object that you want to use.

      For information about registering the entity object with the flexfield usage, see Section 23.2.5, "How to Register Entity Details."

  16. On the Parameters page shown in Figure 23-9, map each flexfield parameter to the entity object attribute that will be the data source for the parameter.

    Parameters are not a requirement for descriptive flexfields. If no parameters are defined for the descriptive flexfield that you are working with, the Parameters page will display a message to that effect. However, if any parameters are defined and associated with a descriptive flexfield, you must map each parameter to an entity object attribute before you can use the flexfield in your application.

    Figure 23-9 Create Flexfield Business Components Wizard — Parameters Page

    Business Components Wizard - Parameters page

    The names in the Parameter Code column represent parameters that have been defined for the descriptive flexfield. For each parameter listed, select the entity object attribute from the Entity Attribute Name dropdown list to use as the data source for that parameter.

    The entity attributes in the dropdown list include the following:

    • Attributes that are part of the entity object you selected as the flexfield data source.

    • Attributes that are part of any entity object that is directly associated with the flexfield entity object through an accessor.

    • Attributes that are part of any entity object that is indirectly associated with the flexfield entity object through a chain of accessors and entity objects.

    Note:

    An entity attribute is available on this list only if all the accessors in the chain to the attribute have an underlying association cardinality of 1-to-1 or many-to-1.

    The path through the chain of accessors to each available entity attribute is displayed using the following notation:

    [accessorname1.[accessorname2.]...]attributename
    

    Although it is not visible, the name of the previously selected flexfield entity object is implied as the first element in the chain, followed by zero or more accessor names, then the target entity attribute name. The names of the entity objects in this chain are also implied.

    Caution:

    Flexfield parameters can be used only with segments of the same Java type. The data type of each entity attribute you select must match the data type shown for the parameter.

  17. When all of the defined parameters are mapped, click Next.

  18. On the Summary page, click Finish.

    Note:

    This wizard might fail with a "ClassNotFound" exception message. This indicates that one or more required libraries have not been automatically included in your project. You can resolve this issue by manually adding any missing libraries; then you can complete this procedure successfully.

  19. Refresh the project to see the newly created flexfield business components in the Application Navigator. The components are in the package that you registered for the flexfield usage and are named using the registered prefix.

23.4 Creating Descriptive Flexfield View Links

A view link is needed whenever a product view object references your descriptive flexfield. The product view object and the flexfield base view object are linked through their primary keys.

23.4.1 How to Create Descriptive Flexfield View Links

You create a view link to connect your product view object with the flexfield view object. After you have created the view link, you can use the view object to add the flexfield to an application page.

Before you begin:

  1. Create the master view object, which contains only nonflexfield attributes.

  2. Create the flexfield business components for the descriptive flexfield as described in Section 23.3.1, "How to Create Descriptive Flexfield Business Components".

To create a descriptive flexfield view link:

  1. From the File menu, choose New.

  2. In the New Gallery, go to Business Tier > ADF Business Components and select Flexfield View Link.

  3. Click OK to access the Create Flexfield View Link wizard, as shown in Figure 23-10.

    Figure 23-10 Create Flexfield View Link Wizard — Name Page

    View Link wizard - Name page
  4. On the Name page, from the Package dropdown list, specify a package for the view link.

    Caution:

    You cannot move the view link to a different package after you create it. Instead, you must delete the view link and re-create it with the new package name.

  5. In the Name field, enter a name for the view link.

  6. Click Next. The View Objects page appears, as shown in Figure 23-11.

    Figure 23-11 Create Flexfield View Link Wizard — View Objects Page

    View Link wizard - View Objects page
  7. In the Select Source View Object tree, expand the available objects from your current project and select the master view object.

  8. In the Select Destination Flexfield tree, expand the application and select a destination flexfield usage.

  9. In the View Link Accessor Name field, enter an appropriate name for the view link accessor.

  10. Click Next.

  11. On the Source Attributes page, click Finish.

    For descriptive flexfields, the Source Attributes page is informational only. The wizard uses the primary key attributes of the source view object to define the view link.

    Note:

    You can skip the Properties page because view link-specific properties are not supported.

  12. On the Summary page, click Finish.

23.5 Nesting the Descriptive Flexfield Application Module Instance in the Application Module

You must nest the descriptive flexfield application module instance under the product application module before you can incorporate the descriptive flexfield usage into the UI.

You need to nest only one flexfield application module for a flexfield usage, even if two or more view links exist for the same flexfield usage.

23.5.1 How to Nest the Descriptive Flexfield Application Module Instance in the Application Module

You use the overview editor for your application module to nest the descriptive flexfield application module instance. The descriptive flexfield application module instance that you nest in the product application module shares the same transaction and entity object caches as the application module.

Before you begin:

  1. You should have already created the product application module. For information about creating application modules, see the "Implementing Business Services with Application Modules" chapter in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

  2. Create the master view object, which contains only nonflexfield attributes.

  3. Create a flexfield business component for the descriptive flexfield usage as described in Section 23.3.1, "How to Create Descriptive Flexfield Business Components."

To nest the descriptive flexfield application module instance in the product application module:

  1. In the Application Navigator, double-click the product application module.

  2. Click the Data Model navigation tab.

  3. On the Data Model Components page, expand the Application Module Instances section, as shown in Figure 23-12.

    Figure 23-12 Application Module — Application Module Instances Section

    application module instances section
  4. In the Available tree, find and expand the applicationModule instance under the flexfield usage's package. This is the package that you specified when you defined the entity details, as described in Section 23.2.5, "How to Register Entity Details."

  5. Select the application module for the descriptive flexfield and move it to the Selected tree.

    This application module was created when you created the flexfield business component and was named using the prefix that you specified when you defined the usage's entity details, as described in Section 23.2.5, "How to Register Entity Details." For example, if you registered the CasesDFF prefix, the application module name is CasesDFFAM.

    The New App Module Instance field under the list shows the name that will be used to identify instance. You can change this name.

23.6 Adding a Descriptive Flexfield View Object to the Application Module

You must add a flexfield view object instance that reflects the hierarchy of the view link that you created in Section 23.4.1, "How to Create Descriptive Flexfield View Links" to the application module for your application.

23.6.1 How to Add a Descriptive Flexfield View Object Instance to the Application Module

Edit the product application module to add the flexfield view object.

Before you begin:

  1. You should have already created the product application module. For information about creating application modules, see the "Implementing Business Services with Application Modules" chapter in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

  2. Create the master view object, which contains only nonflexfield attributes.

  3. Create the flexfield business components for the descriptive flexfield usage as described in Section 23.3.1, "How to Create Descriptive Flexfield Business Components".

  4. Create the flexfield view link as described in Section 23.4.1, "How to Create Descriptive Flexfield View Links."

To add a descriptive flexfield view object to the product application module:

  1. In the Application Navigator, double-click the product application module.

  2. Click the Data Model navigation tab.

  3. In the View Object Instances section, select the master view object from the Available View Objects tree and click the right arrow to add it to the Data Model tree. Next, select the child view object for the flexfield view link and click the right arrow to add it to the Data Model tree, as shown in Figure 23-13.

    Figure 23-13 Application Module — View Object Instances Section

    Master VO and child VL object toggled to the Data Model tree

23.7 Adding Descriptive Flexfield UI Components to a Page

To include a descriptive flexfield on an application page, add the flexfield UI component to the page, and then configure the properties of the UI component.

Note:

You can also use descriptive flexfields in the following ways:

To add a descriptive flexfield UI component, you add the component to a page in the one of the following configurations:

Note:

You cannot use a descriptive flexfield in a tree table component.

If your ADF Table is in an Applications Table component, you must add the following functionality to the UI:

Note:

The following procedures assume that you are using the data-first approach of adding flexfields to your application. The UI-first approach is also available, but is not documented here. For more information about the data-first approach, see the "Introduction to Placeholder Controls" section in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework

23.7.1 How to Add a Descriptive Flexfield UI Component to a Form

Use this procedure to incorporate your descriptive flexfield into a basic form.

Before you begin:

  1. Create the descriptive flexfield view object as described in Section 23.3.1, "How to Create Descriptive Flexfield Business Components".

  2. Create the view link as described in Section 23.4.1, "How to Create Descriptive Flexfield View Links".

  3. Nest the descriptive flexfield application module instance in the product application module as described in Section 23.5.1, "How to Nest the Descriptive Flexfield Application Module Instance in the Application Module".

  4. Add the view object instance to the application module as described in Section 23.6.1, "How to Add a Descriptive Flexfield View Object Instance to the Application Module".

To add a descriptive flexfield UI component to a form:

  1. From the Data Controls panel, select the master view object and drag it onto the page to create the UI for the master view object.

  2. When prompted, select ADF Form or select Applications > Panel.

  3. In the Data Controls panel, expand the master view object and find the flexfield view object, as shown in Figure 23-14.

    Caution:

    You must use the flexfield view object that is the child of the master view object. Do not use the flexfield view object from the flexfield's application module data control.

    Figure 23-14 Flexfield View Object Nested Under Master View Object

    Flexfield view object nested under the master view object
  4. Drag the flexfield view object onto a form, and select the appropriate flexfield UI component.

    Tips:

    • If you place the flexfield in its own tab, header, or subheader, and you cannot provide a specific label for the region, consider using the label "Additional Information," which is the standard generic label in such a case for Oracle Fusion Applications.

    • If a descriptive flexfield is in a region, such as a header, subheader, or tab, that does not contain nonflexfield fields, there is a possibility that the implementor will not use the flexfield segments and the region will be empty. To avoid the display of an empty region on the page, add controlling logic to hide the region if the implementor has not defined the segments that appear in the region. For information about how to determine if a segment has been defined, see Section 23.10.2, "How to Determine Whether Descriptive Flexfield Segments Have Been Defined." For information about using an EL expression to hide the region, see the "Creating EL Expressions" section in the Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework

    • You can place the segments in a multiple-column layout. Use a multiple-column layout when the number of segments that will be added by the implementor is unknown and you anticipate that a large number of segments will be used. Otherwise, a flexfield with several segments will take up a large amount of space and the end user will have to scroll to see any fields that appear below the flexfield.

  5. Optionally, to add Create Row and Delete Row functionality to the UI, drag the appropriate operation of the master view object from the Data Controls panel onto the page.

Tip:

You can configure the descriptive flexfield UI component to present multiple descriptive flexfield rows using the Panel Form Layout component, with each row's content based on a different context value. For more information, see the "Arranging Content in Forms" section of the Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework.

23.7.2 How to Add an Unrestricted Descriptive Flexfield UI Component to a Table

Use this procedure to allow for the full range of possible context segment values. End users will be able to expose or hide the context-sensitive segments of the flexfield separately for each row of data.

Before you begin:

  1. Create the descriptive flexfield view object as described in Section 23.3.1, "How to Create Descriptive Flexfield Business Components".

  2. Create the view link as described in Section 23.4.1, "How to Create Descriptive Flexfield View Links".

  3. Nest the descriptive flexfield application module in the product application module as described in Section 23.5.1, "How to Nest the Descriptive Flexfield Application Module Instance in the Application Module".

  4. Add the view object instance to the application module as described in Section 23.6.1, "How to Add a Descriptive Flexfield View Object Instance to the Application Module".

To add an unrestricted descriptive flexfield UI component to a table:

  1. From the Data Controls panel, select the master view object and drag it onto the page to create the UI for the master view object.

  2. When prompted, select ADF Table or Applications > Table. You must select the Row Selection option, and set the appropriate width.

  3. In the Data Controls panel, expand the master view object and find the flexfield view object.

    Caution:

    You must use the flexfield view object that is the child of the master view object. Do not use the flexfield view object from the flexfield's application module data control.

  4. Drag the flexfield view object onto the table on the design tab, as shown in Figure 23-15, and select Oracle Descriptive Flexfield Column as the UI component. This creates the base flexfield column in the table that the global segments will render.

    Figure 23-15 Descriptive Flexfield Dropped Into a Table

    Descriptive flexfield dropped into a table

    Caution:

    Do not drop the flexfield view object into an existing column. The displaying of descriptive flexfields in the cell of a table column is not supported.

  5. Create a detail region (detailStamp facet) if the table does not have one, as shown in Figure 23-16.

    Figure 23-16 Detail Region — detailStamp Facet

    detailStamp facet in the table
  6. Add a panel layout control to the detailStamp facet if you do not already have one.

  7. Drag and drop the same flexfield view object into the detail region on the Source tab or the structure view as shown in Figure 23-17; this creates fields for the context-sensitive segments.

    Figure 23-17 Descriptive Flexfield Dropped into a Detail Region

    Descriptive flexfield dropped into a detailStamp facet

23.7.3 How to Add Descriptive Flexfield Context-Sensitive Segments to a Table as Columns

Typically, context-sensitive segments in a table are visible only in a detailStamp facet. This is because the flexfield context segment can contain a different value in each table row; therefore the set of associated context-sensitive segments that appears can vary from row to row. There is no way to present all of these varying results in a predefined column format within a single table.

However, if you can guarantee that a given context segment in every row of the table will always contain the same value for a given application page, the resulting combination of corresponding context-sensitive segments in each row will remain constant. In this circumstance the context-sensitive segments can be displayed as table columns.

For example, if the context segment is a country code, and the purpose of this application page is to manage only Italian tax data, then the context value should always be IT. The table columns for the context-sensitive segments will always be displayed in the configuration appropriate to the Italian tax system.

Before you begin:

  1. Create the descriptive flexfield view object as described in Section 23.3.1, "How to Create Descriptive Flexfield Business Components".

  2. Create the view link as described in Section 23.4.1, "How to Create Descriptive Flexfield View Links".

  3. Nest the descriptive flexfield application module in the product application module as described in Section 23.5.1, "How to Nest the Descriptive Flexfield Application Module Instance in the Application Module".

  4. Add the view object instance to the application module as described in Section 23.6.1, "How to Add a Descriptive Flexfield View Object Instance to the Application Module".

To add a descriptive flexfield UI component to a table as a column:

  1. From the Data Controls panel, select the master view object and drag it onto the page to create the UI for the master view object.

  2. When prompted, select ADF Table or Applications > Table. You must select the Row Selection option, and set the appropriate width.

  3. In the Data Controls panel, expand the master view object and find the flexfield view object.

    Caution:

    You must use the flexfield view object that is the child of the master view object. Do not use the flexfield view object from the flexfield's application module data control.

  4. Drag the flexfield view object onto the table on the design tab as shown in Figure 23-15, and select Oracle Descriptive Flexfield Column as the UI component. This creates the base flexfield column in the table.

    Caution:

    Do not drop the flexfield view object into an existing column. The displaying of descriptive flexfields in the cell of a table column is not supported.

  5. Edit the JSP source code for this page, and remove the following attribute from the <fnd:descriptiveFlexfield> tag:

    mode="global"
    

    See Table 23-1 for information about the mode attribute.

  6. Add an additional WHERE clause or view criteria to the master view object to enforce the same predetermined context value for all rows of the table.

    If the context segment will be visible on the page, you must configure the segment to be read-only so end users cannot modify it. For more information, see Section 23.8.2, "How to Configure Segment-Level UI Properties".

23.7.4 How to Add Create Row and Delete Row Functionality to the Page

If your ADF Table is wrapped in an Applications Table component, and if you are using your own Create Insert button to create new rows, you must complete the following steps.

You do not need to complete these steps if new rows are created using the Applications Table's New button or the New option on the Actions menu.

Caution:

If you enable end users to add new flexfield rows to the UI table, you can permit them to enter their own unique key values for a new row. However, you must provide a programmatically generated primary key value for the new row, otherwise it will generate an error.

To add Create Row and Delete Row functionality to the page:

  1. From the Data Controls panel, drag the appropriate operation of the master view object (such as CreateInsert) onto the page.

  2. Delete the newly created button, but not its pageDef entry. Example 23-1 shows an example of the pageDef entry.

    Example 23-1 Executables Element of Page Definition Code

    <executables>
       <iterator Binds="Dff1RefInstance" RangeSize="25" DataControl="Dff1RefAMDataControl" id="Dff1RefInstanceIterator"/>
       <iterator Binds="Dff1Instance" RangeSize="25" DataControl="Dff1RefAMDataControl" id="Dff1InstanceIterator"/>
    </executables>
     
    
  3. Add a new button to the layout.

  4. In the Property Inspector for the button, expand the Common section and set the ActionListener to the EL expression for the method binding. For example, #{myBean.customCreateInsert}.

    Example 23-1 shows how the executables element of the page definition might look. Dff1RefInstanceIterator is the iterator of the master view object.

  5. To ensure that new descriptive flexfield rows appear in the UI, add code to the application page (in the Invoke Application phase or just before the Render Response phase) to set the state of each newly created row to STATUS_NEW, as demonstrated in Example 23-2.

    Example 23-2 Code to Set New Table Row State to STATUS_NEW

    public void invokeMethod(String expr, Class[] paramTypes, Object[] params) 
    {
      FacesContext fc = FacesContext.getCurrentInstance();
      MethodBinding mb = fc.getApplication().createMethodBinding(expr,paramTypes);
      return mb.invoke(fc,params);
    }
    
    public void customCreateInsert(ActionEvent actionEvent)
    {
      invokeMethod("#{bindings.CreateInsert.execute}",ActionEvent.class,actionEvent);
     
      FacesContext fCtx = FacesContext.getCurrentInstance();
      javax.faces.application.Application app = fCtx.getApplication();
      ELContext elCtx = fCtx.getELContext();
      int index = 0;
      Row coreVORow = 
        ((RowSetIterator)app.evaluateExpressionGet(fCtx,
        "#{bindings.Dff1RefInstanceIterator.rowSetIterator}",
        RowSetIterator.class)).getRowAtRangeIndex(index);
     
      coreVORow.setNewRowState(Row.STATUS_NEW);
    }
     
    
  6. Add code to the custom createInsert method to handle an empty table as described in Section 23.7.5, "How to Add a Row to an Empty Table in a Custom createInsert Method"

Caution:

  • If you enable end users to add new flexfield rows to the UI table, you must ensure that the default value of the new row's context segment is your predetermined value, matching the existing rows.

  • You can permit end users to enter their own unique key values for a new row. However, you must provide a programmatically generated primary key value for the new row, otherwise it will generate an error.

  • The context segment value in any existing row must not change at runtime. You must enforce this by hiding the context segment or by configuring it as read-only. For more information, see Section 23.8.1, "How to Configure Flexfield-Level UI Properties" and Section 23.8.2, "How to Configure Segment-Level UI Properties".

23.7.5 How to Add a Row to an Empty Table in a Custom createInsert Method

If you are using a custom createInsert method to add rows to an Applications Table component, you must include code similar to Example 23-3 to handle an empty table. Replace FirstRowInTable with logic to determine whether the table is empty and the new row is the first row in the table.

Example 23-3 Handling Empty Tables in a Custom createInsert Method

if (FirstRowInTable &&
            BindingUtil.getCustomProperty(table, "flexenabled") != null)
        {
           List<UIComponent> columns = table.getChildren();
          if (columns != null)
          {
            for (UIComponent column: columns)
            {
              if (column.getChildCount() > 0)
              {
                UIComponent c1 = column.getChildren().get(0);
                if (c1 instanceof DescriptiveFlexfield)
                {
                  ((DescriptiveFlexfield) c1).createDynamicColumns();
                }
              }
            }
          }
        }

23.7.6 How to Dynamically Refresh a Descriptive Flexfield

If your flexfield is in an ADF Table that is wrapped in an Applications Table component that is refreshed by another component, such as a button or a query, then you must add functionality to dynamically refresh the flexfield segments.

To refresh the flexfield segments based on the current iterator rowset data, create a listener method in the flexfield's backing bean and bind the listener to the component that is initiating the table refresh. The listener must first call the default listener and then call DescriptiveFlexfield.updateFlexColumns(RichTable), where RichTable is the binding for the table that contains the flexfield.

Example 23-4 shows an example of a custom flexfield handler for a query event. The method first calls invokeMethodExpression to call the original query listener, and then calls updateFlexColumns with the table component that contains the flexfield as the parameter. Example 23-5 shows the binding of the custom flexfield handler to the query component.

Example 23-4 Flexfield Listener

public void customDffSearchQueryListener(QueryEvent queryEvent)
{
  invokeMethodExpression(
    "#{bindings.DffCriteriaQuery.processQuery}",
    Object.class,QueryEvent.class,queryEvent);
  DescriptiveFlexfield.updateFlexColumns(appTable);
}

Example 23-5 Binding the Flexfield Listener to the Search Query

<af:query id="qryId1"
  headerText="#{applcoreBundle.QUERY_SEARCH_HEADER_TEXT}"
  disclosed="true"
  value="#{bindings.criteriaQuery.queryDescriptor}"
  model="#{bindings.criteriaQuery.queryModel}"
  queryListener="#{backingBeanScope.dffBean.customDffSearchQueryListener}"
  queryOperationListener="#{bindings.DffCriteriaQuery.processQueryOperation}"
  resultComponentId="::AT2:_ATp:ATt2"/>

Note:

You do not need to handle flexfield refresh for standard Applications Table create and delete operations. However, custom create and delete operations must handle the refreshing of flexfields.

23.7.7 What Happens When You Add a Descriptive Flexfield to a Page

Descriptive flexfield segments appear on a form as a widget with a implementor-defined label, just as core fields do. In a table, the label of the flexfield segment is the column header and the values are within each cell of the column.

Figure 23-18 shows an example of a descriptive flexfield used in a form on an application page.

Figure 23-18 Example of a Descriptive Flexfield in a Form

Example of a descriptive flexfield in a form

Figure 23-19 shows an example of a descriptive flexfield used in a table on an application page:

Figure 23-19 Example of a Descriptive Flexfield In a Table

Example of a descriptive flexfield in a table

Note:

Descriptive flexfield segments always appear as form fields or table columns in the same order that their corresponding attributes appear in the underlying view object.

23.8 Configuring Descriptive Flexfield UI Components

You can control your descriptive flexfield's behavior in the application UI by modifying properties at the flexfield level and the segment level, configuring descriptive flexfield parameters, and configuring the flexfield to handle value change events.

23.8.1 How to Configure Flexfield-Level UI Properties

You configure flexfield-level behavior by configuring the UI component's properties.

Before you begin:

Add the descriptive flexfield to the page as described in Section 23.7, "Adding Descriptive Flexfield UI Components to a Page".

To configure flexfield-level properties:

  • Select the descriptive flexfield's UI component on the page and modify its properties in the Property Inspector, as shown in Figure 23-20.

    Figure 23-20 Descriptive Flexfield Property Inspector

    Descriptive Flexfield Property Inspector

The significant properties on the Common, Data, Style and Behavior property tabs are listed in Table 23-1.

Table 23-1 Descriptive Flexfield Properties

Tab > Property Description

Common > Id

This is the ID of the flexfield.

Common > Rendered

This indicates whether the flexfield is rendered on the page. Values can be True (default) or False. EL expressions are allowed.Foot 1 

Common > Value

This is the value of the flexfield. This should be an EL expression pointing to an iterator object. The iterator value must be statically declared in the page definition.

This field is also visible on the Data tab.

Data > Accessor

This property is the name of the accessor between the product view object and the flexfield view object.

Data > Category

This defines which category will be rendered on the page. The category can be set on each attribute's custom property.

Style > StyleClass

This property is the style class of the flexfield. A style class allows you to group a set of inline styles.

Style > InlineStyle

This is the inline style of the component. The InlineStyle property is a string of CSS styles that can set individual properties such as background color, font style, or padding.

Behavior > Read-Only

This indicates whether the flexfield is rendered as read-only. Values can be True or False (default). EL expressions are allowed.

Behavior > Mode

This defines the UI mode of the descriptive flexfield component, to render all of the segments or just some of them. Values can be:

  • No value (default): render all of the descriptive flexfield segments.

  • global: render only the global segments of the flexfield. This is the default value for a descriptive flexfield inside a table column, to generate subcolumns for the global segments.

  • contextSensitive: render only the context-sensitive segments of the flexfield (including the context segment). This is the default value for a descriptive flexfield inside a table detail region, to render the context values.

Behavior > partialTriggers

This property is the IDs of the components that should trigger a partial update in the flexfield (String[]). EL expressions are allowed.

Behavior > valueChangeListener

This property is a method reference to a value change listener (javax.faces.el.MethodBinding). It requires an EL expression.

Behavior > binding

This is an EL reference that will store the component instance on a bean (oracle.apps.fnd.applcore.flex.ui.DescriptiveFlexfield). This property requires an EL expression.


Footnote 1 For a descriptive flexfield that was added as table columns, you cannot control this property on a row-by-row basis. It must be set to apply to the entire column.

23.8.2 How to Configure Segment-Level UI Properties

Descriptive flexfields support finer control of segments in the UI through the following segment-level UI properties:

  • Rendered: This boolean property indicates whether the segment is visible on the application page. You can set this property with a literal value or an EL expression.

  • Required: This boolean property indicates whether the segment must have a value. You can set this property with a literal value or an EL expression.

  • ReadOnly: This boolean property indicates whether end users can modify the segment. You can set this property with a literal value or an EL expression.

  • Visible: This boolean property specifies whether the segment is displayed in the page or is hidden. You can set this property with a literal value or an EL expression.

  • AutoSubmit: This boolean property specifies whether or not a component automatically submits when a segment's value changes. You can set this property with a literal value or an EL expression.

  • Label: This string property provides a display label for a segment.

  • ShortDesc: This string property provides a short description of a segment.

  • Columns: This integer property specifies the width of the control in terms of the default font size of the browser. You can set this property with a literal value or an EL expression.

The default values of these properties are derived from the flexfield metadata, but you can override them by inserting the following flexfield hint components from the Applications page of the Component Palette:

  • Flexfield Context Segment Hints: Use this component to configure the context segment.

  • Flexfield Segment Hints: Use this component to configure all global segments or to configure all context-sensitive segments. Also use this component as a container for Flexfield Segment Hint.

  • Flexfield Segment Hint: Nest this component in a Flexfield Segment Hints component to configure an individual global or context-sensitive segment.

Note:

If you set a segment's Required property to True, for validation purposes you cannot override this by resetting it to False in the flexfield hint component. You can, however, do the reverse: Change a nonrequired segment to required in the flexfield hint component.

For information about using EL expressions, see the "Creating ADF Data Binding EL Expressions" section in the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

Before you begin:

Add the descriptive flexfield to the page as described in Section 23.7, "Adding Descriptive Flexfield UI Components to a Page".

23.8.2.1 Configuring a Context Segment

Use Flexfield Context Segment Hints to set the Visible, ReadOnly, Rendered, Required, Label, ShortDesc, Columns, and AutoSubmit UI properties for a context segment.

To configure a context segment:

  1. From the Applications page of the Component Palette, drag Flexfield Context Segment Hints and drop it as a child of the Descriptive Flexfield component.

  2. In the Property Inspector, set the context segment's UI properties.

23.8.2.2 Configuring All Global Segments

Use Flexfield Context Hints to set the Visible, ReadOnly, Rendered, and Required properties to the same values for all the global segments.

To configure all global segments:

  1. From the Applications page of the Component Palette, drag Flexfield Segment Hints and drop it as a child of the Descriptive Flexfield component.

  2. In the Property Inspector, set the Visible, ReadOnly, Rendered, and Required properties.

  3. Ensure that the ContextCode property is blank.

Caution:

For a descriptive flexfield that was added as table columns, you cannot configure the Rendered property of global segments on a row-by-row basis. It must be set to apply to the entire column.

23.8.2.3 Configuring Individual Global Segments

Use a Flexfield Segment Hint component nested in a Flexfield Segment Hints component to set the Visible, ReadOnly, Rendered, Required, Label, ShortDesc, Columns, and AutoSubmit UI properties for a global segment.

You typically set the ReadOnly property to True if a default value is assigned to that segment, and you do not want end users to choose a value other than the default. Do not set both Required and ReadOnly to True if the segment does not have a default value.

Before you begin:

From the Applications page of the Component Palette, drag Flexfield Segment Hints and drop it as a child of the Descriptive Flexfield component. Do not set any properties.

To configure a global segment:

  1. From the Applications page of the Component Palette, drag Flexfield Segment Hint and drop it as a child of Flexfield Segment Hints.

  2. In the Property Inspector, set the SegmentCode property.

    Tip:

    To determine the correct value for the SegmentCode property, examine the FND_ACFF_SegmentName attribute of the segment's viewAttribute element in the descriptive flexfield view object.

  3. Set the global segment's UI properties.

23.8.2.4 Configuring All Context-Sensitive Segments

Use Flexfield Context Hints to set the Visible, ReadOnly, Rendered, and Required UI properties to the same values for all the context-sensitive segments.

To configure all global segments:

  1. From the Applications page of the Component Palette, drag Flexfield Segment Hints and drop it as a child of the Descriptive Flexfield component.

  2. In the Property Inspector, set the ContextCode property.

  3. Set the Visible, ReadOnly, Rendered, and Required properties.

23.8.2.5 Configuring Individual Context-Sensitive Segments

Use a Flexfield Segment Hint component nested in a Flexfield Segment Hints component to set the Visible, ReadOnly, Rendered, Required, Label, ShortDesc, Columns, and AutoSubmit UI properties for a context-sensitive segment.

You typically set the ReadOnly property to True if a default value is assigned to that segment, and you do not want end users to choose a value other than the default. Do not set both Required and ReadOnly to true if the segment does not have a default value.

Before you begin:

From the Applications page of the Component Palette, drag a Flexfield Segment Hints and drop it as a child of the Descriptive Flexfield component. Set the ContextCode property.

To configure a context-sensitive segment:

  1. From the Applications page of the Component Palette, drag Flexfield Segment Hint and drop it as a child of Flexfield Segment Hints.

  2. In the Property Inspector, set the SegmentCode property.

    Tip:

    To determine the correct value for the SegmentCode property, examine the FND_ACFF_SegmentName attribute of the segment's viewAttribute element in the descriptive flexfield view object.

  3. Set the context-sensitive segment's UI properties.

23.8.3 How to Configure Descriptive Flexfield Parameters

You must add all the parameters that you have registered for the flexfield to the partialTriggers list so that each parameter's associated UI component is refreshed when its attribute is changed.

Before you begin:

  1. Define and register the necessary parameters, if any, as described in Section 23.2.6, "How to Register Descriptive Flexfield Parameters".

  2. Add the descriptive flexfield to the page as described in Section 23.7, "Adding Descriptive Flexfield UI Components to a Page".

To configure descriptive flexfield parameters:

  1. Identify each UI component that corresponds (through the flexfield view object) to an entity object attribute to which a flexfield parameter is mapped, and ensure that the ID attribute of the UI component is set.

    For example, say you mapped the Customer parameter to the entity object Customer_Name attribute, which in turn has a corresponding view object attribute called Customer_Name and is displayed on the page using an inputText field with the prompt "Customer Name". You would ensure that this UI component has an ID, say, customerInputText.

  2. In the Behavior section of the Property Inspector for the descriptive flexfield UI component, add the UI component ID to the list in the PartialTriggers field.

    In the previously introduced example, you would add customerInputText to the PartialTriggers list. Example 23-6 shows the source view of the partialTriggers attribute.

    Example 23-6 Adding the UI Component ID to the PartialTriggers List

    <fnd:descriptiveFlexfield value="#{bindings.Dff1Iterator}"
    partialTriggers=customerInputText>
    

23.9 Loading Seed Data

Any implementation of flexfields in Oracle Fusion Applications typically requires application seed data, which is the essential data to enable flexfields to work properly in applications. Flexfield seed data can be uploaded and extracted using the Seed Data Loader.

After you complete the registration process described in Section 23.2.2, "How to Register and Define Descriptive Flexfields," your flexfield seed data consists of the information that you registered for your flexfield, such as the tables and columns reserved for your flexfield. For a customer flexfield, the seed data contains only this registration data.

If your flexfield is a developer flexfield, you also serve the role of the implementor. In addition to the registration data, your flexfield seed data might include contexts, segments, and value sets that you have defined for your flexfield.

For information about extracting and loading seed data, see Chapter 56, "Initializing Oracle Fusion Application Data Using the Seed Data Loader".

23.10 Working with Descriptive Flexfield UI Programmatically

When working with descriptive flexfields programmatically, you might need to know how to do the following tasks:

23.10.1 How to Update a Descriptive Flexfield Programmatically

When you update a flexfield programmatically, you must obtain the same flexfield view row that is used by the UI. You use the getFlexfieldVORowFromEvent method to get a handle to a flexfield view row from the ValueChangeEvent instance.

public static Row getFlexfieldVORowFromEvent(ValueChangeEvent vce);

Update the context value on the flexfield, not the master view row. Otherwise, the structure will not change. Do not update the entity object directly. The flexfield's structure logic is in the setter of the view row, so do not bypass it.

23.10.2 How to Determine Whether Descriptive Flexfield Segments Have Been Defined

Your application might require information about any global or context-sensitive segments that exist in a descriptive flexfield's metadata before it invokes a UI that includes the flexfield.

There is a view attribute in the descriptive flexfield view object, _FLEX_NumOfSegments, that contains the combined total number of global segments and context-sensitive segments in the flexfield. Its value is in the java.lang.Integer data format. This value may vary depending on the context.

The value of this view attribute is the number of segments defined in the metadata. For a given descriptive flexfield view row, a value of 0 means that only the context segment is available. Whether a segment is displayed is not taken into consideration.

23.10.3 How to Configure a Descriptive Flexfield to Handle Value Change Events

You can configure your application to recognize and respond to changes in individual descriptive flexfield segment values.

You register a value change listener to capture any ValueChangeEvent that occurs. When an end user changes a segment value, the input components associated with the flexfield segments on the application page deliver a value change event, and the listener is called.

Before you begin:

Add the descriptive flexfield to the page as described in Section 23.7, "Adding Descriptive Flexfield UI Components to a Page".

To configure a descriptive flexfield to handle value change events

  1. Create the listener handler as a Java method (usually on a backing bean). Example 23-7 is an example of a method that handles a ValueChangeEvent.

    Example 23-7 Sample Listener Handler Method

    public void dffChangeListener(ValueChangeEvent valueChangeEvent) {
         System.out.println("***** In dffChangeListener()");
         System.out.println("getSource() = " + valueChangeEvent.getSource());
         System.out.println("getOldValue() = " + valueChangeEvent.getOldValue());
         System.out.println("getNewValue() = " + valueChangeEvent.getNewValue());
        }
    
  2. Specify the handler method as UI metadata on the flexfield's value change listener property (described in Table 23-1). In the Property Inspector, click the Edit button for the value change listener property, and a wizard appears to help you select an existing event listener or create a new listener. Example 23-8 is an example of the metadata as an EL expression that identifies the dffChangeListener listener from the Java method in Example 23-7.

    Example 23-8 Sample EL Expression Identifying dffChangeListener

    <fnd:descriptiveFlexfield value="#{bindings.PJCDFF1Iterator}"
         valueChangeListener=
         "#{managed_DFFHeaderTablePropHandler.dffChangeListener}"
         autoSubmit="true">
    

For more information about handling value change events, see the "Using Input Components and Defining Forms" chapter inOracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework.

23.11 Incorporating Descriptive Flexfield into a Search Form

You can include descriptive flexfield view object attributes as search criteria in an advanced query search form. This form enables end users to define ad hoc criteria to search for data in the application's master view object and its linked descriptive flexfield view object. End users can select which attributes of the descriptive flexfield view object to use as search criteria.

23.11.1 How to Incorporate Descriptive Flexfields Into a Search Form

To incorporate a descriptive flexfield into a search form, use the Edit Query Criteria tab to add view criteria to a view object instance and then drop the view criteria onto the page as a Query Panel with results.

To add a descriptive flexfield to a search form:

  1. Add view criteria to the product view object instance that uses attributes from the view-linked descriptive flexfield view object, as shown in Figure 23-21.

    Figure 23-21 Edit Query Criteria Tab of View Object View Criteria Definition

    Edit Query Criteria tab of view criteria definition
    1. Enter a name for the view criteria definition and select the view accessor attribute from the master view object. The attributes of the view-linked descriptive flexfield view object appear.

    2. Select the context segment (the discriminator) and use it as the attribute in the view criteria definition.

  2. Create a new JSPX page in the user interface project.

    Tip:

    Oracle JDeveloper names the user interface project ViewController by default.

  3. In the Data Control panel, select the named view criteria that you created previously.

  4. Drag and drop the view criteria onto the page as a Query Panel with results, as shown in Figure 23-22.

    Figure 23-22 Page with Descriptive Flexfield Search Form

    Page with descriptive flexfield search form
  5. Run the new search form page and click the Advanced button. When you click Add Fields, only the attributes associated with the base descriptive flexfield view object (global segments) are available as additional criteria. To include the context-sensitive attributes for a context, select the equal to operator for the Context Value criteria item and select a context. The Add Fields list refreshes to include the context-sensitive attributes from the subtype view object for the selected context, as shown in Figure 23-23.

    Note:

    Figure 23-6 illustrates the attributes associated with the base descriptive flexfield view object (global segments) and the context-sensitive attributes.

    Figure 23-23 Descriptive Flexfield Search Form UI

    Descriptive flexfield search form UI

    For more information about working with search forms, see the "Creating ADF Databound Search Forms" chapter of Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

23.12 Preparing Descriptive Flexfield Business Components for Oracle Business Intelligence

Oracle Business Intelligence is a comprehensive collection of enterprise business intelligence functionality that provides the full range of business intelligence capabilities including interactive dashboards, full ad hoc, proactive intelligence and alerts, enterprise and financial reporting, real-time predictive intelligence, and more.

While descriptive flexfields are modeled using polymorphic view objects, flexfield technology is not compatible with Oracle Business Intelligence, which also requires reference data, such as lookups, to be modeled as view-linked child view objects. To enable a descriptive flexfield to be used by Oracle Business Intelligence, it must be flattened into a usable static form. To flatten the flexfield into a static form, enable the flexfield and its segments for business intelligence, create the flexfield business components, and create the flexfield view links and application modules using a slightly modified process.

23.12.1 How to Enable a Descriptive Flexfield for Oracle Business Intelligence

If you want implementors to be able to do business intelligence queries on whatever segments they configure for a flexfield, you must enable the flexfield and its segments.

You can set the business intelligence–enabled flag at registration time using the fnd_flex_df_setup_apis.create_flexfield(...) procedure, or you can set the flag later using the fnd_flex_df_setup_apis.update_flexfield(...) procedure. For information about using these procedures, see Section 23.2.2.2.1, "What You May Need to Know About the Descriptive Flexfield Setup API."

You can enable the segments for business intelligence using the Manage Descriptive Flexfields task, which is accessed from the Oracle Fusion Applications Setup and Maintenance work area, as described in the "Configuring Descriptive Flexfields" section in Oracle Fusion Applications Extensibility Guide.

An alternative way to business intelligence–enable a descriptive flexfield and its segments is to set the BIEnableFlag to Y at both the descriptive flexfield level and the segment level in the descriptive flexfield seed data file (SDF), as shown in Example 23-9.

Example 23-9 Business Intelligence–Enabled Descriptive Flexfield

<DescriptiveFlexfield>
    <ApplicationId>0</ApplicationId>
    <DescriptiveFlexfieldCode>FLEX_DFF1</DescriptiveFlexfieldCode>
    ...
    <Delimiter>.</Delimiter>
    <BIEnabledFlag>Y</BIEnabledFlag>
    ...
    <ContextSegment>
      <ContextCode>Context Data Element</ContextCode>
      <SegmentCode>Context Segment</SegmentCode>
      ...
      <ReadOnlyFlag>N</ReadOnlyFlag>
      <BIEnabledFlag>Y</BIEnabledFlag>
      ...
    </ContextSegment>
    ...
    <GlobalSegment>
       <ContextCode>Global Data Elements</ContextCode>
       <SegmentCode>GlobalSegment2</SegmentCode>
       ...
       <ReadOnlyFlag>N</ReadOnlyFlag>
       <BIEnabledFlag>Y</BIEnabledFlag>
       ...
    </GlobalSegment>
    ...
    <Context>
      <ContextCode>VS_FRM_CHR_ON_CHR</ContextCode>
      ...
      <Segment>
        <SegmentCode>L10</SegmentCode>
        ...
        <ReadOnlyFlag>N</ReadOnlyFlag>
        <BIEnabledFlag>Y</BIEnabledFlag>
        ...
      </Segment>
      ...
    </Context>
    ...
    <Context>
      <ContextCode>VS_FRM_CHR_ON_CHR2</ContextCode>
      ...
      <Segment>
        <SegmentCode>L10</SegmentCode>
        ...
        <ReadOnlyFlag>N</ReadOnlyFlag>
        <BIEnabledFlag>Y</BIEnabledFlag>
        <BIEqualizationTag>L10_TAG</BIEqualizationTag>
        ...
      </Segment>
      ...
    </Context>
    ...
  <DescriptiveFlexfield>

23.12.2 How to Flatten the Descriptive Flexfield Model for a Business Intelligence–Enabled Descriptive Flexfield

When you create business components for a business intelligence–enabled descriptive flexfield, the business component modeler recognizes the business intelligence–enabled setting. A view object that is flattened for Oracle Business Intelligence is generated alongside the standard descriptive flexfield polymorphic view object. You must also slightly modify the process of creating descriptive flexfield view links and application modules.

Note:

When you make changes to a business intelligence–enabled flexfield, you use the Import Metadata wizard to import the changes into the Oracle Business Intelligence repository as described in the "Using Incremental Import to Propagate Flex Object Changes" section in the Oracle Fusion Middleware Metadata Repository Builder's Guide for Oracle Business Intelligence Enterprise Edition (Oracle Fusion Applications Edition) (Oracle Fusion ApplicationsEdition).

Before you begin:

  1. Enable the flexfield and the desired segments for Oracle Business Intelligence as described in Section 23.12.1, "How to Enable a Descriptive Flexfield for Oracle Business Intelligence."

  2. If you have defined trees on any of the value sets that are referenced by the flexfield, ensure that the flattened tree view objects are already in your project. Otherwise, the Create Flexfield Business Components wizard that you use to create the flexfield business components will report the missing view objects as errors.

    For more information about flattened tree view objects, see Section 60.8.1, "Designing a Column-Flattened View Object for Oracle Business Intelligence." For more information about value sets, see the "Creating Custom Value Sets" section in the Oracle Fusion Applications Extensibility Guide.

To produce a business intelligence–enabled flattened descriptive flexfield model:

  1. Create descriptive flexfield business components as described in Section 23.3, "Creating Descriptive Flexfield Business Components".

    For a flexfield that is business intelligence-enabled, the Create Flexfield Business Components wizard generates a business intelligence-specific view object and other business components under a directory called analytics in the package root directory. These are generated in addition to the standard descriptive flexfield view object.

  2. Create a view link using the procedure described in Section 23.4, "Creating Descriptive Flexfield View Links". Keep the following in mind:

    • The master view object that you create with the standard wizard can be the same master view object that you create for the core descriptive flexfield model.

    • Create the view link from the master view object to the business intelligence-enabled flexfield base view object. The business intelligence-enabled flexfield is distinguished from the core flexfield by the prefix "BI:" as shown in Figure 23-24.

      Figure 23-24 Create Flexfield View Link Wizard — View Objects Page

      View Link wizard - View Objects page
  3. Create an application module for use with Oracle Business Intelligence as described in Section 23.6, "Adding a Descriptive Flexfield View Object to the Application Module." Make the following changes:

    1. On the Data Model page of the Create Application Module wizard, when you create an instance of the master view object, there is no need for a child view object.

    2. On the Application Modules page of the wizard, add an instance of the descriptive flexfield Oracle Business Intelligence application module as a nested instance of this application module. You can identify the Oracle Business Intelligence application module by the analytics subpackage under the package root.

    Note:

    If you already have a product Oracle Business Intelligence application module, you may use it.

  4. Define the custom properties required to link the master view object instance to the default view instance inside the nested flexfield Oracle Business Intelligence application module instance.

    This is done on the General tab of the nested business intelligence-enabled flexfield application module instance definition, as shown in Figure 23-25.

    Figure 23-25 Custom Properties for Business Intelligence-Enabled Application Module

    Business intelligence application module custom properties

    As you define the custom properties, keep the following points in mind:

    • The default view instance inside the business intelligence-enabled flexfield application module is typically called DefaultFlexViewUsage.

    • The custom property names should be formatted as BI_VIEW_LINK_mypropertyname

    • The custom property values must be formatted as source_viewobjectinstance_name, viewlink_definition_name, destination_viewobjectinstance_name.

    • Use the fully qualified view object instance names for the source view object and destination view object, and the fully qualified package name for the view link definition.

    • Business intelligence joins between the view object instances that you specify in different application modules are created while importing them from Oracle ADF if custom properties are defined on the application module.

23.13 Publishing Descriptive Flexfields as Web Services

You can make access to a descriptive flexfield available through web services, which will enable you to create, retrieve, update and delete operations on the flexfield data rows. You accomplish this by exposing the descriptive flexfield application module as a web service and adding utility methods to support the flexfield service data project to the product application module.

When you generate a flexfield business component, the descriptive flexfield business components and other artifacts are developed based on the information in the flexfield metadata. As illustrated in Figure 23-6, a base view object is created for the context and global segments. If any contexts have been configured, subtype view objects are generated for each configured context.

The example in Figure 23-26 shows a Business Component Browser view of a descriptive flexfield.

Figure 23-26 Business Component Browser View of a Descriptive Flexfield

Application module view of a descriptive flexfield

To complete the development process to publish descriptive flexfields as web services:

  1. Expose the descriptive flexfield as a web service.

  2. Test the web service.

23.13.1 How to Expose a Descriptive Flexfield as a Web Service

To make available web service access to a descriptive flexfield, you must complete the following steps:

  1. Service-enable the master view object.

  2. Expose the application module as a web service.

  3. Expose the operations on the master view object.

  4. Add utility methods for the flexfield to the product application module.

You can then deploy the service and run Java client programs to test the service as described in Section 23.13.2, "How to Test the Web Service."

For more information about service-enabling an application module, see "Integrating Service-Enabled Application Modules" in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

Before you begin:

  1. Create a flexfield business component for the flexfield's usage as described in Section 23.3.1, "How to Create Descriptive Flexfield Business Components."

    Note:

    When you generate a flexfield business component, the Create Descriptive Flexfield Business Components wizard automatically service-enables the business component by generating a Service Data Object (SDO) for the base view object and for every subtype view object.

  2. Create a flexfield view link between the master view object, which contains only nonflexfield attributes, and the flexfield business component for the flexfield usage as described in Section 23.4.1, "How to Create Descriptive Flexfield View Links."

  3. Nest the descriptive flexfield application module instance in the product application module as described in Section 23.5.1, "How to Nest the Descriptive Flexfield Application Module Instance in the Application Module."

  4. Add the view object instance to the application module as described in Section 23.6.1, "How to Add a Descriptive Flexfield View Object Instance to the Application Module."

To expose a descriptive flexfield as a web service:

  1. In the Application Navigator, open the view link between the master view object and the flexfield base view object.

  2. In the overview editor, expand the Custom Properties section and add a SERVICE_PROCESS_CHILDREN property set to true, if one does not already exist.

  3. Open the master view object, which is the view object that contains only the nonflexfield attributes.

  4. In the overview editor click the Java navigation tab.

  5. In the Java Classes section, click the Edit icon to generate and configure Java implementation classes.

  6. In the Select Java Options dialog, select Generate Service Data Object Class and click OK, as shown in Figure 23-27.

    Figure 23-27 Generating a Service Data Object Class for the Master View Object

    Service Data Object Class selected in dialog box
  7. From the Application Navigator, open the product application module.

  8. In the overview editor, click the Service Interface navigation tab.

  9. If the Add icon is enabled, complete the following steps to service-enable the application module and expose the master view object operations:

    1. Click the Add icon to enable the application to support the Service interface.

    2. In the Create Service Interface wizard, click Next twice to go to the Service View Instances page.

    3. Move the view instance for the master view object to the Selected list.

    4. Select the master view object from the Selected list as shown in Figure 23-28, select all the operations in the Basic Operations list, and click OK.

      Figure 23-28 Selecting Master View Object Instances to Expose

      All basic operations selected for master view object
    5. Click Finish.

  10. If the Add icon is disabled, the application is already service enabled. Complete the following steps to expose the master view object operations:

    1. In the Service Interface View Instances section, click the Edit icon.

    2. Move the view instance for the master view object to the Selected list.

    3. Select the master view object from the Selected list as shown in Figure 23-28, select all the operations in the Basic Operations list, and click OK.

  11. Expand the Generated Files for Service Interface section, and make a note of the name of the remote server class for the product application module. This is the class that has a name ending with ServiceImpl.java.

  12. In the overview editor for the product application module, click the Java navigation tab and click the link for the Application Module Class.

  13. Add the utility methods shown in Example 23-10 to the application module class. These utility methods enable web service clients to obtain FlexfieldSdoSupport objects to access flexfield information.

    Replace Flexfield with the appropriate string for the flexfield that you are working with.

    In the getFlexfieldSdoSupport method, replace getDffAM with the name of the getter method for the nested flexfield application module.

    Example 23-10 Utility Methods for Flexfield Service Data Object Support

    public List<String> getFlexfieldSdoNamespaceAndName(String contextValue)
        {
          FlexfieldSdoSupport ss = getFlexfieldSdoSupport(contextValue);
          if (ss == null)
          {
            return null;
          }
          return Arrays.asList(ss.getSdoNamespace(), ss.getSdoName());
        }
     
        public String getFlexfieldTypeSdoPath()
        {
          FlexfieldSdoSupport ss = getFlexfieldSdoSupport(null);
          if (ss == null)
          {
            return null;
          }
          return ss.getDiscriminatorSdoPath();
        }
     
        public List<String> getFlexfieldSegmentSdoPaths(String contextValue,
                                                      List<String> segmentCodes)
        {
          FlexfieldSdoSupport ss = getFlexfieldSdoSupport(contextValue);
          if (ss == null)
          {
            return null;
          }
          ArrayList r = new ArrayList(segmentCodes.size());
          for (String segmentCode: segmentCodes)
          {
            r.add(ss.getSegmentSdoPath(segmentCode));
          }
          return r;
        } 
    
        public FlexfieldSdoSupport getFlexfieldSdoSupport(String contextValue)
        {
          // Set contextValue to null to get the parent (base)
          // Find the nested flexfield application module instance
          DFFApplicationModuleImpl am =
           (DFFApplicationModuleImpl) getDffAM();
          return am.getSdoSupport(contextValue);
       }
    
  14. In the overview editor for the product application module, click the Service Interface navigation tab for the product application module and click the Edit icon in the Service Interface Custom Methods section.

  15. In the Service Custom Methods dialog, move the newly added methods to the Selected list to make them available for clients and click OK.

    The application module's remote server implementation class will be modified to expose these methods.

23.13.2 How to Test the Web Service

You can test the service by adding StringRefAddr elements to the Reference element for the product application module's service to the connections.xml file, deploying and manually testing the service, and optionally creating and running Java client programs to test the service.

Before you begin:

To test the web service:

  1. Expand Application Resources > Descriptors > ADF Meta-INF, and open the connections.xml file.

  2. Locate the Reference element for the product application module's service (DFF1MasterApplicationModuleService in this example).

  3. Add the StringRefAddr elements that are shown in bold in Example 23-11 to the Reference element for the product application module's service. Modify the host and port number in the jndiProviderURL entry to point to Oracle WebLogic Server. The port number is typically 7101.

    Example 23-11 StringRefAddr Elements to Add to Service Reference in connections.xml

    <Reference name="{http://xmlns.oracle.com/oracle/apps/fnd/applcore/flex/test/dff1/model/}DFF1MasterApplicationModuleService" className="oracle.jbo.client.svc.Service" xmlns="">
       <Factory className="oracle.jbo.client.svc.ServiceFactory"/>
       <RefAddresses>
          <StringRefAddr addrType="serviceInterfaceName">
             <Contents>oracle.apps.fnd.applcore.flex.test.dff1.model.DFF1MasterApplicationModuleService</Contents>
          </StringRefAddr>
          <StringRefAddr addrType="serviceEndpointProvider">
             <Contents>ADFBC</Contents>
          </StringRefAddr>
          <StringRefAddr addrType="jndiName">
             <Contents>DFF1MasterApplicationModuleServiceBean#oracle.apps.fnd.applcore.flex.test.dff1.model.DFF1MasterApplicationModuleService</Contents>
          </StringRefAddr>
          <StringRefAddr addrType="serviceSchemaName">
             <Contents>DFF1MasterApplicationModuleService.xsd</Contents>
          </StringRefAddr>
          <StringRefAddr addrType="serviceSchemaLocation">
             <Contents>oracle/apps/fnd/applcore/flex/test/dff1/model/</Contents>
          </StringRefAddr>
          <StringRefAddr addrType="jndiFactoryInitial">
             <Contents>weblogic.jndi.WLInitialContextFactory</Contents>
          </StringRefAddr>
          <StringRefAddr addrType="jndiProviderURL">
             <Contents>t3://localhost:port_number</Contents>
          </StringRefAddr>
          <StringRefAddr addrType="jndiSecurityPrincipal">
             <Contents>weblogic</Contents>
          </StringRefAddr>
          <StringRefAddr addrType="jndiSecurityCredentials">
             <Contents>weblogic1</Contents>
          </StringRefAddr>
       </RefAddresses>
    </Reference>
     
    
  4. Run the remote server class for the product application module to deploy the service to Integrated WebLogic Server and to manually test the web service.

    Note:

    The remote server class was generated when you exposed the descriptive flexfield as a web service in Section 23.13.1, "How to Expose a Descriptive Flexfield as a Web Service." This class has a name that ends with ServiceImpl.java.

  5. Optionally, create and run Java client programs to test invoking the web service:

    The following examples demonstrate how to write programs to test the web service.

Example 23-12 Web Service Get Operation

package oracle.apps.fnd.applcore.flex.test.dff1.model.test;
 
import ...
 
public class DFFTester {
    private static final String PK1 = "MY_PRIMARY_KEY";
    public DFFTester() {
        super();
    }
   public void getFKRowGivenKey(){
    try
    {
      DFF1MasterApplicationModuleService dff1Service =
        (DFF1MasterApplicationModuleService)
        ServiceFactory.getServiceProxy(
        DFF1MasterApplicationModuleService.NAME);
 
      List<String> dff1Info = dff1Service.getMyFlexfieldSdoNamespaceAndName(null);
      System.out.println(dff1Info);
 
      final String contextValue = "MY_CONTEXT_VALUE";
      List<String> dffInfo2 =
          dff1Service.getMyFlexfieldSdoNamespaceAndName(contextValue);
      System.out.println(dffInfo2);
       
       
      MasterDff masterVOSDO = dff1Service.getMasterDff1(PK1);
      DataObject dataObject = (DataObject) masterVOSDO;
      String uri = dataObject.getType().getURI();
      XMLHelper xmlhelper = ServiceFactory.getXMLHelper(dff1Service);
      String xml = xmlhelper.save(dataObject, uri, "MasterDff");
      System.out.println(xml);
 
    }
        }catch(Exception e){
            e.printStackTrace();
        }
    }
 
    public static void main(String args[]){
          DFFTester dfftester =new DFFTester(); 
          dfftester.getFKRowGivenKey();
    }
}

Example 23-13 Example XML Payload Output of Web Service Get Operation

<?xml version="1.0" encoding="UTF-8"?>
<ns2:MasterDff xmlns:ns2="http://xmlns.oracle.com/apps/fnd/applcore/flex/test/dff1/model/" xmlns:ns1="http://xmlns.oracle.com/apps/fnd/applcore/flex/test/dff1/flex/dff1/" xmlns:ns0="http://xmlns.oracle.com/adf/svc/types/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:MasterDff">
<ns2:CreatedBy>0</ns2:CreatedBy>
<ns2:CreationDate>2009-12-03T23:39:25.0-08:00</ns2:CreationDate>
<ns2:LastUpdateDate>2009-12-03T23:39:25.0-08:00</ns2:LastUpdateDate>
<ns2:LastUpdateLogin>0</ns2:LastUpdateLogin>
<ns2:LastUpdatedBy>0</ns2:LastUpdatedBy>
<ns2:PrimaryKeyCode>VS_IND_COC_DEP_DAT_ON_DAT05</ns2:PrimaryKeyCode>
<ns2:ProductContext xsi:nil="true"/>
<ns2:ProductDate xsi:nil="true"/>
<ns2:ProductNumber xsi:nil="true"/>
<ns2:ProductVarchar2 xsi:nil="true"/>
<ns2:dff1 xsi:type="ns1:Dff1VS_5FIND_5FCOC_5FDEP_5FDAT_5FON_5FDAT">
<ns1:PrimaryKeyCode>VS_IND_COC_DEP_DAT_ON_DAT05</ns1:PrimaryKeyCode>
<ns1:_FLEX_ValidationDate>2009-12-03</ns1:_FLEX_ValidationDate>
<ns1:_GlobalSegment1>05</ns1:_GlobalSegment1>
<ns1:_GlobalSegment2>Value05</ns1:_GlobalSegment2>
<ns1:_GLOBAL_STATE_ID_NUM xsi:nil="true"/>
<ns1:_GLOBAL_STATE_ID_NUM_Display xsi:nil="true"/>
<ns1:_FLEX_Context>VS_IND_COC_DEP_DAT_ON_DAT</ns1:_FLEX_Context>
<ns1:_FLEX_NumOfSegments>5</ns1:_FLEX_NumOfSegments>
<ns1:_State>RI</ns1:_State>
<ns1:_State_Holiday>2007-08-12</ns1:_State_Holiday>
</ns2:dff1>
</ns2:MasterDff> 

Example 23-14 Web Service Create Operation

...
    public void createMasterDffRow() {
        try {
 
            DFF1MasterApplicationModuleService dff1Service =
                (DFF1MasterApplicationModuleService)
                ServiceFactory.getServiceProxy(
                DFF1MasterApplicationModuleService.NAME);
            DataFactory dataFactory =
                ServiceFactory.getDataFactory(dff1Service);
            MasterDffImpl dffMaster =
                (MasterDffImpl)dataFactory.create(MasterDff.class);
            dffMaster.setPrimaryKeyCode(PK1);
 
            final String contextValue = "MY_CONTEXT";
            List<String> dffInfo =
                dff1Service.getMyFlexfieldSdoNamespaceAndName(contextValue);
            System.out.println(dffInfo);
            DataObject dffSubType =
                dataFactory.create(dffInfo.get(0), dffInfo.get(1));
            System.out.println(dff1Service.getMyFlexfieldTypeSdoPath());
            dffSubType.set(dff1Service.getMyFlexfieldTypeSdoPath(), contextValue);
            dffSubType.set(dff1Service.getMyFlexfieldSegmentSdoPaths(contextValue,
              Arrays.asList("GLOBAL_STATE_ID_NUM")).get(0),
                           new BigDecimal(100));
            dffSubType.set(dff1Service.getMyFlexfieldSegmentSdoPaths(contextValue,
              Arrays.asList("Date_On_Date")).get(0),
                           java.sql.Date.valueOf("2011-04-18"));
            dffMaster.setDff1(dffSubType);
            dff1Service.createMasterDff1(dffMaster);
 
 
            MasterDffImpl masterVOSDO =
                (MasterDffImpl)dff1Service.getMasterDff1(PK1);
            String updatedXML =
                DFFTester.extractXMLFromDataObject(dff1Service, masterVOSDO);
            System.out.println("<<<--------Updated XML output-------------->");
            System.out.println("");
            System.out.println(updatedXML);
 
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
...

Example 23-15 Web Service Update Operation

...
    public void updateMasterDffRow() {
        try {
 
            DFF1MasterApplicationModuleService dff1Service =
                (DFF1MasterApplicationModuleService)
                ServiceFactory.getServiceProxy(
                DFF1MasterApplicationModuleService.NAME);
            DataFactory dataFactory =
                ServiceFactory.getDataFactory(dff1Service);
 
            MasterDffImpl dffMaster =
                (MasterDffImpl)dff1Service.getMasterDff1(PK1);
            XMLHelper xmlhelper = ServiceFactory.getXMLHelper(dff1Service);
            String uri = dffMaster.getType().getURI();
            String xml = xmlhelper.save(dffMaster, uri, "MasterDff");
            System.out.println(xml);
 
 
            Object dffObject = dffMaster.getDff1();
            System.out.println("Dff Object Name->" +
                               dffObject.getClass().getName());
 
            final String contextValue = "MY_CONTEXT";
            List<String> dffInfo =
                dff1Service.getMyFlexfieldSdoNamespaceAndName(contextValue);
            System.out.println(dffInfo);
            DataObject dffSubType =
                dataFactory.create(dffInfo.get(0), dffInfo.get(1));
            System.out.println(dff1Service.getMyFlexfieldTypeSdoPath());
            dffSubType.set(dff1Service.getMyFlexfieldTypeSdoPath(), contextValue);
 
            dffSubType.set(dff1Service.getMyFlexfieldSegmentSdoPaths(contextValue,
              Arrays.asList("GlobalSegment1")).get(0),
                           new BigDecimal(02));
            dffSubType.set(dff1Service.getMyFlexfieldSegmentSdoPaths(contextValue,
              Arrays.asList("P6_S0_On_Number")).get(0),
                           new BigDecimal(123));
            dffMaster.setDff1(dffSubType);
            dff1Service.updateMasterDff1(dffMaster);
 
 
            dffMaster = (MasterDffImpl)dff1Service.getMasterDff1(PK1);
            String updatedXML =
                DFFTester.extractXMLFromDataObject(dff1Service, dffMaster);
            System.out.println("<<<--------Updated XML output-------------->");
            System.out.println("");
            System.out.println(updatedXML);
 
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
...
 

23.14 Accessing Descriptive Flexfields from an ADF Desktop Integration Excel Workbook

ADF Desktop Integration makes it possible to combine desktop productivity applications with Oracle Fusion Applications, so you can use a program like Microsoft Excel as an interface to access application data.

Using ADF Desktop Integration, you can incorporate descriptive flexfields into an integrated Excel workbook, so you can work with the flexfield data from within the workbook.

TheOracle Fusion Middleware Desktop Integration Developer's Guide for Oracle Application Development Framework provides most of the information you need to complete the required activities, including the following:

The Oracle Fusion Middleware Desktop Integration Developer's Guide for Oracle Application Development Framework does not make explicit reference to flexfields. In addition to the standard implementation steps covered in that guide, you must modify your implementation to accommodate flexfields.

There are two ways to access a descriptive flexfield in Excel:

The descriptive flexfield's segments are part of your database table, so the flexfield is generated against the same entity object on which your worksheet view object is based.

To complete the process for accessing descriptive flexfields from an ADF Desktop Integration Excel workbook:

  1. Configure ADF Desktop Integration with either a dynamic or static column descriptive flexfield.

  2. If using a dynamic column descriptive flexfield where the end user can control the context value, modify the application to update the descriptive flexfield structure whenever user-initiated context value changes occur in the dynamic column descriptive flexfield.

  3. Create a custom method to process updates or inserts for descriptive flexfield data row and add code to invoke the method.

23.14.1 How to Configure ADF Desktop Integration with a Dynamic Column Descriptive Flexfield

When you configure the ADF Desktop Integration Table, make the following changes:

  • Add the ADF Desktop Integration Model API library to your data model project.

  • In your page definition for the worksheet, add the descriptive flexfield that you want to access to the master worksheet view object as a child node. Do not add any display attribute to the child node that expands as a dynamic column in the worksheet.

    For more information about how to create a page definition file for an ADF Desktop Integration project, see the "Working with Page Definition Files for an Integrated Excel Workbook" section of the Oracle Fusion Middleware Desktop Integration Developer's Guide for Oracle Application Development Framework.

  • To make the descriptive flexfield column of the ADF Desktop IntegrationTable dynamic, set the DynamicColumn property in the TableColumn array of the ADF Desktop Integration Table to True. A dynamic column in the TableColumn array is a column that is bound to a tree binding or tree node binding whose attribute names are not known at design time. A dynamic column can expand to more than a single worksheet column at runtime.

    For more information about the binding syntax for dynamic columns, see the "Adding a Dynamic Column to Your ADF Desktop Integration Table" section of the Oracle Fusion Middleware Desktop Integration Developer's Guide for Oracle Application Development Framework.

  • For the table's UpdateComponent and InsertComponent properties, specify one of the following as the subcomponent to use:

    • Inputtext

    • OutputText

    • ModelDrivenColumnComponent

  • For the subcomponent's Value property, access the Expression Builder, expand the Bindings node and your tree binding for the table, and select the flexfield node.

  • For the subcomponent's Label property, access the Expression Builder, expand the Bindings node and your tree binding for the table, and select the flexfield node.

23.14.2 How to Handle User-Initiated Context Value Changes in a Dynamic Column Descriptive Flexfield

ADF Desktop Integration requires that to use a dynamic column implementation, the structure of the descriptive flexfield must remain constant for all rows in a given result set. However, each time a new result set is downloaded into the table, the context value (and thus the structure) can be changed.

If the context value is set globally for the end user of the workbook, changes are not an issue. However, if the user can control the context value (for example, using a list of values (LOV) in a header form), your application must be able to respond appropriately to update the descriptive flexfield structure.

After the end user specifies a context value, you must invoke the worksheet UpSync method to get the new value into the model layer. Then you can use the ADF Desktop Integration Table Download method to get fresh data with the new descriptive flexfield structure.

Note:

For an insert-only table, the Download method is undesirable. For these cases, use either the ADF Desktop Integration Table DownloadForInsert method or the Initialize method to enable the ADF Desktop Integration Table to reconfigure to accommodate the new flexfield structure.

23.14.3 How to Configure ADF Desktop Integration with a Static Column Descriptive Flexfield

If the structure of your descriptive flexfield varies from row to row in a given result set, you cannot implement the flexfield as a dynamic column — it will produce errors. You must use a static column with a popup dialog.

Note:

If a specific dialog title cannot be provided because the configuration of the flexfield will not be known until implementation, use "Additional Information" for the title, which is the standard generic label in such a case for Oracle Fusion Applications.

ADF Desktop Integration supports descriptive flexfields by using tree bindings in an ADF Desktop Integration Table. If you are adding your descriptive flexfield as a static column, you can alternatively use an ADF Desktop Integration Read-Only Table. Keep in mind that ADF Desktop Integration Read-Only Table supports static columns, but not dynamic columns. Popup dialogs support both types.

Note:

A descriptive flexfield appears as a node in the tree binding at design time. Because flexfields are built up dynamically at runtime, you will not see any attributes under the flexfield node in the page definition, but the node itself is present.

When you configure the popup dialog, make the following changes:

  • You can use the column's action set properties to make the descriptive flexfield web page available for editing. Include the attributes used in the web page in the table's cached attributes unless the row will be committed immediately.

  • You must choose a fixed attribute (a descriptive flexfield global segment attribute) to represent the flexfield in the worksheet. Add a Dialog action to the DoubleClickActionSet component action of an InputText or OutputText component, then connect the Dialog action to JSPX page that will display the descriptive flexfield.

    For more information about how to create a page definition file for an ADF Desktop Integration Table project, see the "Working with Page Definition Files for an Integrated Excel Workbook" section of the Oracle Fusion Middleware Desktop Integration Developer's Guide for Oracle Application Development Framework.

For static display of a descriptive flexfield in an ADF Desktop Integration workbook, you must create an updatable transient attribute in the view object on which the ADF Desktop Integration Table is based. This transient attribute will hold the concatenated value of the descriptive flexfield segments, separated by a delimiter. If one purpose of the worksheet is to display existing data from the database, the transient attribute should be populated using custom application module methods upon returning from a popup dialog or opening the worksheet.

23.14.4 How to Handle Updating or Inserting of a Descriptive Flexfield Data Row

To handle updating or inserting of a data row containing a descriptive flexfield in an ADF Desktop Integration Table, you call a custom application module method that contains appropriate code, as follows:

  • To update an existing row, add your code to the UpdateRowActionId property of the table.

  • To insert a new row, add your code to the InsertAfterRowActionId property of the table.

The context value should be set before calling the application module method, which gets called in the doubleclickactionset component action of the table's UpdateComponent or InsertComponent properties. This is applicable for both dynamic column and static column display of descriptive flexfields. Setting the context value appropriately is important because this controls the structure of the flexfield.

The following examples demonstrate the code needed to accomplish these tasks. Example 23-16 and Example 23-17 apply to an ADF Desktop Integration implementation with the descriptive flexfield exposed as a static column. Example 23-18 presents the isSegmentDisplayable() method that is used in the other two examples.

Example 23-16 Updating or Inserting a Row with a Static Column Descriptive Flexfield

//Retrieve your worksheet view object
  myworksheet_VOImpl srcVO = myVO
     
//Retrieve the current row from your view object. 
//That is the row that is being processed by ADF Desktop Integration.
 
  myworksheet_VO_Row_Impl srcRow = myworksheet_VO_Row_Impl srcVO.getCurrentRow();
 
 //This gives the transient attribute value from your worksheet.
  Object dffAttributeValue = srcRow.getAttribute(mytransientattribute);
 
 //Get the descriptive flexfield row based on the descriptive flexfield view accessor.
  DFFViewRowImpl dffRow = (DFFViewRowImpl)srcRow.getAttribute(mydff_viewaccessor);
 
 //Check if the single cell value is null.
 if (dffAttributeValue != null && !("").equals(dffAttributeValue)) {
      //Getting DFF metadata information
      FlexfieldViewDefImpl dffImpl =
          (FlexfieldViewDefImpl)dffRow.getFlexfieldViewDef();
      String delim = dffImpl.getDelimiter();
      //Parse the DFF string into tokens
      StringTokenizer token =
          new StringTokenizer(dffAttributeValue.toString(), delim);
 
      while (token.hasMoreTokens()) {
          prjValues.add(token.nextToken());
      }
  }
  //Get the descriptive flexfield segment information.
  ListAttributeDef listSeg =
      dffRow.getFlexfieldViewDef().getFlexfieldAttributes();
 
  Iterator listSegIterator = listSeg.iterator();
  AttributeDef seg = null;
  ListString segDisplay = new ArrayListString();
  while (listSegIterator.hasNext()) {
      seg = (AttributeDef)listSegIterator.next();
      if (isSegmentDisplayable(seg, dffRow)) {
          segDisplay.add(seg.getName());
      }
  }
 
  //Get the size of the segment.
  int segValueSize=0;
  if (dffAttributeValue != null && !("").equals(dffAttributeValue))
      segValueSize = prjValues.size();
  else
      segValueSize = segDisplay.size();
 
  //This check is required to handle a context dependent DFF case.
  //If the context is changed before uploading, do not proceed.
  if (segValueSize < prjValues.size())
     return;
  if (segDisplay.size()==0)
     return;
 
  for (int i = 0; i < segValueSize; i++) {
     if (dffAttributeValue != null && !("").equals(dffAttributeValue)) {
          if (prjValues.get(i) != null && !prjValues.get(i).equals(" ")){
              dffRow.setAttribute(segDisplay.get(i), prjValues.get(i));
           } else {
              dffRow.setAttribute(segDisplay.get(i), null);
           }
     } else {
          dffRow.setAttribute(segDisplay.get(i), null);
      }
  }

Example 23-17 Applying Modified Segment Values to a Cell in a Static Column Descriptive Flexfield

Add this code as an application module method that will be invoked by clicking the OK button of a popup dialog. This method can also be used to populate transient attribute values used for single cell display upon opening the worksheet, if the worksheet is intended to display existing records from the database.

//Retrieve the DFF row through the DFF view accessor.
 DFFViewRowImpl dffRow = 
  (DFFViewRowImpl)row.getAttribute(
  "DFF_viewaccessorattribute_from_worksheetVO");
 
//Get the delimiter information for your DFF.
 FlexfieldViewDefImpl dffImpl =
     (FlexfieldViewDefImpl)dffRow.getFlexfieldViewDef();
 String delim = dffImpl.getDelimiter();
 
//Get the segment information for your DFF.
 ListAttributeDef listSeg =
     dffRow.getFlexfieldViewDef().getFlexfieldAttributes();
 
 //Your DFF will have many segments, but not all of them will be used for display.
 //This code loops through DFF segments and obtains the name and type
 //of each displayable segment.
 Iterator listSegIterator = listSeg.iterator();
 AttributeDef seg = null;
 Liststring segDisplay = new ArrayListstring();
 Listinteger segDisplayType = new ArrayListinteger();
 
 while (listSegIterator.hasNext()) {
     seg = (AttributeDef)listSegIterator.next();
      if (isSegmentDisplayable( seg,dffRow)) {
                 segDisplay.add(seg.getName());
                 segDisplayType.add(new Integer(seg.getSQLType()));
             }
   }
int segDisplaySize = segDisplay.size();
StringBuffer segmentString = new StringBuffer();   
 
  //  This loop is constructing a string out of displayed segment values
  //  with a delimiter in between each segment value.
 
  //  If the segment type is date, remove the time from the date.
  //  For the first segment (i=0), you need to handle it differently
  //  to construct the string correctly.
        for (int i = 0; i < segDisplaySize; i++) {
            if (dffRow.getAttribute(segDisplay.get(i)) != null) {
                if (i == 0) {
                    if (segDisplayType.get(i) == 91) {
                        StringTokenizer stTime =
                             new
 StringTokenizer(dffRow.getAttribute(segDisplay.get(i)).toString(), " ");
                          segmentString.append(stTime.nextToken());
                    } else {
                         segmentString.append(dffRow.getAttribute(segDisplay.get(i)));
                    }
               } else {
                      segmentString.append(delim);
                     if (segDisplayType.get(i) == 91) {
                        if (dffRow.getAttribute(segDisplay.get(i)) != null) {
                           StringTokenizer stTime =
                               new
 StringTokenizer(dffRow.getAttribute(segDisplay.get(i)).toString(), " ");
                          segmentString.append(stTime.nextToken());
                        } else {
                           segmentString.append(
                             dffRow.getAttribute(segDisplay.get(i)));
                     }
                 } else {
                     segmentString.append(dffRow.getAttribute(segDisplay.get(i)));
                 }
                                       }
             }else {
                 if (i==0)
                     segmentString.append(" ");
                  else {
                     segmentString.append(delim);
                     segmentString.append(" ");
                 }
             }
         }
   row.setyour_transient_attribute(segmentString)

Example 23-18 isSegmentDisplayable() Helper Method Used in the Previous Examples

The input parameters for this method are the segment attribute definition and the descriptive flexfield row.

public boolean isSegmentDisplayable(AttributeDef seg,
                                       DFFViewRowImpl dffRow) {
    if (seg.getProperty("FND_ACFF_DisplayAttributeName") == null) {
        if (seg.getProperty(seg.getUIHelper().ATTRIBUTE_DISPLAY_HINT) ==null ||
            !seg.getProperty(
              seg.getUIHelper().ATTRIBUTE_DISPLAY_HINT).equals("Hide")) {
               return true;
          } else {
               return false;
        }
    } else {
        int attrIndex =
            dffRow.getFlexfieldViewDef().getAttributeIndexOf(
              seg.getProperty("FND_ACFF_DisplayAttributeName").toString());
        AttributeDef displayAttrDef =
            dffRow.getFlexfieldViewDef().getAttributeDef(attrIndex);
        if (displayAttrDef.getProperty(
          seg.getUIHelper().ATTRIBUTE_DISPLAY_HINT) == null ||
            !displayAttrDef.getProperty(
              seg.getUIHelper().ATTRIBUTE_DISPLAY_HINT).equals("Hide")) {
               return true;
        } else {
               return false;
        }
    }
}