This discussion is archived
2 Replies Latest reply: Apr 2, 2012 11:20 PM by 927940 RSS

How to get the Flex field value?

927940 Newbie
Currently Being Moderated
Key Flex field doubt. How to get the Code combination id from flex field in OAF?

I am following the below code and steps.

In Property Inspector
--------------------------

ID - ExpAcc
Item Style - Flex
View Instance - GlCodeCombinationsKfvVO1
Appl short name - SQLGL
Name - GL#
Type - Key

VO query
------------------

SELECT CODE_COMBINATION_ID
FROM GL_CODE_COMBINATIONS_KFV


Controller Class Code
---------------------------

In Process Request

OAKeyFlexBean CCIDlovEnabledKFF = (OAKeyFlexBean)webBean.findIndexedChildRecursive("ExpAcc");

if (CCIDlovEnabledKFF != null)
{        
//Set the KFF item property to have a concatenated segment display.
CCIDlovEnabledKFF.useCodeCombinationLOV(true);
//Set the KFF Name
CCIDlovEnabledKFF.setAttributeValue(FLEXFIELD_NAME, "GL#");
//Set the KFF Structure
CCIDlovEnabledKFF.setStructureCode("OPERATIONS_ACCOUNTING_FLEX");
//Set the VO attribute name to the item
CCIDlovEnabledKFF.setCCIDAttributeName("CodeCombinationId");
CCIDlovEnabledKFF.mergeSegmentsWithParent(pageContext);
//setFireActionForSubmit ("ExpAcc",null, null,true, true);

//Execute the Query so that we will have some data in VO while we run the page.
OAApplicationModule am = pageContext.getApplicationModule(webBean);
OAViewObject sampleViewObject =
(OAViewObject)am.findViewObject("GlCodeCombinationsKfvVO1");
sampleViewObject.executeQuery();

I am using the above mentioned code.
This code displays the Account in flex field(OAF page) but it doesn’t return the code combination id, when we insert this flex field value into the database it inserts null.


How to get the Code combination id from flex field in OAF?

Please send the code and steps as soon as possible.
  • 1. Re: How to get the Flex field value?
    700122 Explorer
    Currently Being Moderated
    I think you need following line after merging segments. i.e. after CCIDlovEnabledKFF.mergeSegmentsWithParent(pageContext);


    CCIDlovEnabledKFF.processFlex(pageContext);

    Thanks,
    Mukesh Uchaniya
  • 2. Re: How to get the Flex field value?
    927940 Newbie
    Currently Being Moderated
    Thanks Mukesh for your reply. I am tried with Procesflex. As u said, am added CCIDlovEnabledKFF.processFlex(pageContext); this line after mergeSegment. But its not returning a code combination id.

    Now, I am currently using bellow code.

    In Property Inspector
    --------------------------

    ID - ExpAcc
    Item Style - Flex
    View Instance - GlCodeCombinationsKfvVO1
    Appl short name - SQLGL
    Name - GL#
    Type - Key

    VO query
    ------------------

    SELECT CODE_COMBINATION_ID
    FROM GL_CODE_COMBINATIONS_KFV


    In Process Request
    --------------------------

    OAKeyFlexBean CCIDlovEnabledKFF = (OAKeyFlexBean)webBean.findIndexedChildRecursive("ExpAcc");

    if (CCIDlovEnabledKFF != null)
    {        
    String T_Stname = pageContext.getParameter("T_Stname"); //T_Stname returns the Structure code based on Asset Book from previous page.
    //Set the KFF item property to have a concatenated segment display.
    CCIDlovEnabledKFF.useCodeCombinationLOV(true);
    //Set the KFF Name
    CCIDlovEnabledKFF.setAttributeValue(FLEXFIELD_NAME, "GL#");
    //Set the KFF Structure
    CCIDlovEnabledKFF.setStructureCode(T_Stname); //in runtime we r passing the structure code
    //Set the VO attribute name to the item
    CCIDlovEnabledKFF.setCCIDAttributeName("CodeCombinationId");
    CCIDlovEnabledKFF.mergeSegmentsWithParent(pageContext);
    }

    In Process Form Request
    ------------------------------------

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    {
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);

    String T_ExpAcc = pageContext.getParameter("ExpAcchidden"); // ExpAcchidden is a FormValue
    System.out.println("T_ExpAcc ="+T_ExpAcc);      
    }


    FormValue In Property Inspector
    ---------------------------------
    ID - ExpAcchidden
    Item Style - FormValue
    View Instance - GlCodeCombinationsKfvVO1 //this same VO am used for flex also
    View Attribute     - CodeCombinationId

    In OAF page,When I click the Submit button first time, the FormValue returns Null. When I click the Submit button second time, the FormValue returns correct code combination id.
    I don’t know, why it returns null value while clicking the Submit button first time.


    Please reply as soon as possible.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points