18 Using Flexfields

This chapter gives an introduction to flexfields and describes how to work with flexfields in Oracle Data Integrator.

Introduction to Flexfields

Flexfields are user-defined fields, which enable you to customize the properties of ODI objects.

Flexfields are set for each object type through the Flexfield tab of each Object’s window. Flexfields exist only for certain object types, objects that do not have a Flexfield tab do not support them. When accessing object properties through ODI substitution methods, if you specify the Flexfield Code, ODI will substitute the Code by the flexfield value for the object type.

Creating Flexfields

To create such flexfields,

  • Navigate to the Security module under Objects accordion.

  • Select an Object and right click -> Open or you can double click the object, to edit the parameters of the object

  • Select the Flexfields tab and click the Add iconAdd Icon present at the top right Toolbars pane, to add a new flexfield

    Note:

    Flexfieds can be technology specific, or can be visible for all technologies. For example - The flexfield highlighted below will only be visible for Oracle Datastores because the object on which we have added a flexfield is a datastore, and we are limiting this flexfield to Oracle technology.

    Figure 18-1 Creating Flexfields

    Description of Figure 18-1 follows
    Description of "Figure 18-1 Creating Flexfields"
  • Enter the required details such as Name, Code, Technology, Type and Default value for the newly created flexfield and click OK.

The new flexfield is created and once you have created the flexfield you can then populate it with values in Designer module.

Setting Values for Flexfields

To set values for the created flexfields,
  1. Navigate to Designer module and edit the parameters of the object associated with the newly created flexfield. It has the following fields:
    1. Name – Name of the created flexfield
    2. Value - This column initially displays the default value that you had set in the security module, (for example – Hello).
    3. If you wish to change the default value and edit it, the Default check box is unchecked automatically. If you select it, the value is set to the configured default value (for example – Hello) again.

    Figure 18-2 Setting Values for Flexfields

    Description of Figure 18-2 follows
    Description of "Figure 18-2 Setting Values for Flexfields"

    Note:

    Only flexfields specific to the technology of the edited object appear in the Flexfields tab (other flexfields are not visible). For example - Flexfields specific to SAP and Hive technologies displayed inFigure 18-1 do not appear in the Figure 18-2 as the edited object uses the Oracle technology.

Retrieving Values for Flexfields

You can retrieve the assigned values for the flexfields in two different ways. They are:
  1. Step 1 - If you already know the object for which you want to retrieve a flexField value, you can use native APIs for that object. For example, for a datastore, the Step 1 - If you already know the object for which you want to retrieve a flexField value, you can use native APIs for that object. For example, for a datastore, theodiRef.getTable(<FlexField_code>) gives you the proper value. So here <%=odiRef.geTable('MYFLEX')%>returns Hellofor the table AGG_SALES
  2. Step 2 – Alternatively, you can also use substitution API getFlexFieldValue() to retrieve the value of a flexfield. This substitution API takes three attributes. They are:
    1. The first attribute is the internal identifier of the object type. You can retrieve this through the definition tab of the object in the Designer module.
      Edit the Datastore for which you want to retrieve the flexfield value and go to the Version tab of this object. You can see the Internal ID (25 in the example below for the Datastore AGG_SALES)

      Figure 18-3 First Attribute for Retrieving Values in Flexfields

      Description of Figure 18-3 follows
      Description of "Figure 18-3 First Attribute for Retrieving Values in Flexfields"

      Note:

      If you need to retrieve this ID programmatically, use object specific substitution API - getTable('ID'), and this returns that ID specific to the selected datastores.
    2. The second attribute is the internal identifier of the object type. You can retrieve this through the definition tab of the object in the Security module.
      Navigate to Designer module to edit the parameters of the object and then click the Version tab of the object. You can retrieve the Internal ID for the selected object (For example, Internal ID for the below DataStore is 2400)

      Figure 18-4 Second Attribute for Retrieving Values in Flexfields

      Description of Figure 18-4 follows
      Description of "Figure 18-4 Second Attribute for Retrieving Values in Flexfields"
    3. The third attribute is the code of the flexfield, from the above example it is MYFLEX. For example, for the API call — <%=odiRef.getFlexFieldValue("25","2400","MYFLEX")%> returns the value Hello.