Overview of Key Flexfields

Key flexfields provide a means to capture a key such as a part number, a job code, or an account code. A key flexfield consists of one or more segments, where each segment can have a meaning.

For example, a part number 10-PEN-BLA-450 might correspond to a black pen from supplier #450 sold by division #10 (office supplies). Behind the scenes, the application uses a unique number, 13452, for this part, but the user always sees the 10-PEN-BLA-450 part number.

The following aspects are important to understanding key flexfields:

  • Architecture

  • Segments and segment labels

  • How to Identify Segments

  • How the Override, Visible, and Rendered Properties Work

  • Structures and segment instances

  • Combinations

  • Dynamic combination creation

  • Security

Key flexfields aren't optional. You must configure key flexfields to ensure that your applications operate correctly. You configure and maintain key flexfield definitions with the Manage Key Flexfields task. To get a list of predefined key flexfields, use the Manage Key Flexfields task in the Setup and Maintenance work area. For information about specific key flexfields, see the help for the product where the associated business component is implemented.

Architecture

Flexfield metadata is stored in the flexfield metadata tables. When you configure a key flexfield, you define metadata about the key flexfield covering aspects such as:

  • Segments are in a structure

  • Structures in the flexfield

  • Value sets in each segment

Based on the flexfield metadata, actual part numbers are captured as a combination of segment values and stored in a combinations table. A combinations table contains all the segment columns for a flexfield, a unique ID column, and a structure instance number column. The structure instance number column differentiates multiple arrangements of the segment columns. For example, a part number containing multiple segments can be represented by a key flexfield. A part number key flexfield has a corresponding combinations table. In that table, the flexfield stores a list of the complete codes, with each segment of the code in a column, with the corresponding unique ID and structure instance number for the code. When users define a new part number or maintain existing part numbers in the parts catalog, they directly maintain rows in the combinations table.

The foreign key table contains a different business entity than the combinations table. For example, the business entity in the foreign key table is order lines or invoice lines that contain foreign key references to parts for ordering. Any number of foreign key tables can reference a particular entity represented by a key flexfield.

Segments and Segment Labels

A key flexfield contains segments. Each segment contains these details:

  • A prompt

  • A short prompt

  • Display width

  • The sequential position of the segment within the key flexfield structure

  • The range type

  • Column name of the attribute being stored by the segment

  • A default value set

  • A label for the segment

How to Identify Segments

You can identify and control a segment within a key flexfield using a segment label. Segment labels act as tags for the segments, and these labels are defined by application developers. For example, say in the accounting flexfield, you want to identify which segment contains balancing information and which one contains natural account information. A segment label identifies the segment that contains natural account information. When you define your accounting flexfield, you must specify the segment labels for each segment. Some segment labels must be unique, and can't be applied to more than one segment in each structure. Other labels are required and must be applied to at least one segment in each structure.

You can also use a segment label to search for segments, such as the Cost Center label for all segments across key flexfields that store a value for the cost center. To identify and control a segment in key flexfield, you can set several segment properties in the flexfield XML with a literal value or an EL expression. These properties are attributes of the <flexfieldLabeledSegmentHint> element of the flexfield. These property settings apply to all segments that have the specified segment label assigned to them.

Property

Description

SegmentLabel

Indicates the segment label for the segment being configured.

Rendered

Indicates whether the segment is available on the page. You can set the value to True, False, or EL expression

Required

Indicates whether users must enter some data for the component before they save. You can set the value to True, False, or EL expression.

Read-only

Indicates whether the users can modify the segment. You can set the value to True, False, or EL expression.

Visible

Indicates whether the segment is visible on the page. You can set the value to True, False, or EL expression.

Label

Indicates the display text for the segment.

ShortDesc

Indicates the text that appears when users hover over the component.

Columns

Indicates the width of the text control in terms of the number of characters shown. The number of columns is calculated based on the default font size of the browser. You can set this property with a literal value or EL expression.

Override

Indicates whether a certain child component inside a parent component is visible. You can set the value to True, False, or EL expression. When you use this property along with the visible property, it overrides the visible property of the parent component.

How the Override, Visible, and Rendered Properties Work

Let's look at a few scenarios:

  • Here's a snippet of code without the override property:

    <fnd:keyFlexfieldPartial value="#{bindings.Kff1PaInstanceIterator}" id="kfp1" visible="false">
    		<fnd:flexfieldLabeledSegmentHint
    			segmentLabel="SEGMENT_LABEL_R1" visible="true"/>
    </fnd:keyFlexfieldPartial>

    In this case, the visible property of the child component is set to true and the visible property of the parent component is set to false. So, segments with SEGMENT_LABEL_R1 aren't visible because the visible property of the child component is used in conjunction with the visible property of the parent component.

  • Here's a snippet of code with the override property:

    <fnd:keyFlexfieldPartial value="#{bindings.Kff1PaInstanceIterator}" id="kfp1" visible="false">
    		<fnd:flexfieldLabeledSegmentHint 
             		segmentLabel="SEGMENT_LABEL_R1" visible="true" override="true"/>
    </fnd:keyFlexfieldPartial>

    Here also, the visible property of the child component is set to true and the visible property of the parent component is set to false. But you're also setting the override property of the child component to true. So, segments with SEGMENT_LABEL_R1 are visible because the visible property of the child component overrides the visible property of the parent component.

Remember, you must not use the rendered property along with the override property, because when you set the rendered property to false at the flexfield level, the Oracle ADF module ignores the rendered property at the segment level. For example, consider this snippet of code:

<fnd:keyFlexfieldPartial value="#{bindings.Kff1PaInstanceIterator}" id="kfp1" rendered="false">
		<fnd:flexfieldLabeledSegmentHint 
        			segmentLabel="SEGMENT_LABEL_R1" rendered="true" override="true"/>
</fnd:keyFlexfieldPartial>

Though you set the rendered property to true at the segment level, this property is ignored. That's because the rendered property is set to false at the flexfield level. So, make sure that you use the visible property instead of the rendered property along with the override property.

Structures and Segment Instances

A key flexfield structure definition includes the number of segments and their order.

In some applications, different users like to see different segment structures for the same flexfield. A key flexfield can have multiple structures if registered to support more than one structure.

The flexfield can display different fields for different users based on a data condition in your application data, such as the value of another field entered by the user or the user's role. For example, the correctly formatted local postal address for customer service inquiries differs based on locale. A postal address key flexfield could display different segments and prompts for different users based on a location condition in your application data, such as the user's role or a value entered by the user.

Each structure can have one or more segments. Thus a segment is a child of a structure. To store a particular segment, such as Cost Center, in two different structures, you must define the segment separately in each structure. Each structure may have one or more structure instances. Each instance of a structure shares the same number and order of segments, but differs in the values or value sets used in validating the segments.

You can define multiple configurations of a key flexfield structure. These structure instances have the same segment structure, in the same sequence order. They differ primarily in how each segment is validated. You define a structure instance for each key flexfield and each key flexfield structure instance.

The segments in a key flexfield structure instance are segment instances. A segment instance is a segment with a specific value set assigned to it. If a key flexfield is registered with a tree structure, you can specify a tree code for a segment instance.

Combinations

A combination is a complete code, or combination of segment values that makes up the code, that uniquely identifies an object.

For example, each part number is a single combination, such as PAD-YEL-11x14 or 01-COM-876-7BG-LTN. In these combinations, the hyphen is the segment separator. If you have ten parts, define ten combinations. A valid combination is an existing or new combination that can be used because it's currently active and doesn't violate cross-validation or security rules. A combination has different segments depending on the flexfield structure being used for that combination. Any combination is associated with only one particular flexfield structure.

Many applications refer to a key flexfield combination by using the name of the entity or the key flexfield itself. For example, Assets uses the asset key flexfield and refers to one of its combinations as an asset key or asset key flexfield. In another example, Oracle General Ledger refers to combinations of the accounting flexfield as account or GL account.

Each key flexfield has one corresponding table, known as the combinations table, where the flexfield stores a list of the complete codes, with one column for each segment of the code, together with the corresponding unique ID number (an account combination ID) for that code. Then, other tables in the application have a column that stores just the unique ID for the code. For example, you may have a part number code, such as PAD-YEL-11x14. The Parts combinations table stores that code along with its ID, 57494. If your application lets you take orders for parts, you might then have an Orders table that stores orders for parts. That Orders table would contain a single column that contains the part ID, 57494, instead of several columns for the complete code PAD-YEL-11x14. Typically, one combinations page maintains the key flexfield, where the key flexfield is the representation of an entity in your application. Maintain individual combinations, such as part numbers in the combinations page.

Dynamic Combination Creation

Dynamic combination creation is the insertion of a new valid combination into a combinations table from a page other than the combinations page. The following table lists the levels at which dynamic combination creation may be enabled.

Level Of Dynamic Combination Creation

Controlled By

Flexfield

Application development

Each usage or reference to the key flexfield

Application development

Structure instance

Administrators and implementation consultants

Other

Administrators and implementation consultants

If your key flexfield or certain usages or references of the key flexfield don't permit dynamic combination creation, you may control whether dynamic combination creation is enabled for each structure instance. If enabled, a user can enter a new combination of segment values using the flexfield window from a foreign key page. For example, when entering a transaction, a GL user can enter a new expense account combination for an account that doesn't yet exist. Your application creates the new account by inserting the new combination into the combinations table behind the scenes. Assuming that the new combination satisfies any existing cross-validation rules, the flexfield inserts the new combination into the combinations table, even though the combinations table isn't the underlying table for the foreign key page.