Dependent poplist based on another dependent poplist inside table

  1. sreenathpappstechnical

    sreenathpappstechnical Starter

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    10
    Location:
    dubai
    Hello experts,



    I have a requirement as below.

    I have a table in which i need 2 dependent poplists.

    First dependent poplist for Inventory Orgs, which will show all the inventory organizations based on Form Value OrgIdLine.



    In processRequest, i am binding this with the OrgIdLine as shown below:



    OAAdvancedTableBean table = (OAAdvancedTableBean)webBean.findChildRecursive("ItemSubinvsRN");

    OAMessageChoiceBean orgCodeBean = (OAMessageChoiceBean) webBean.findIndexedChildRecursive("OrganizationCode");

    orgCodeBean.setListVOBoundContainerColumn(0, /* bind index */ table,"OrgIdLine");

    orgCodeBean.setPickListCacheEnabled(false);



    here is the query for this poplist.



    select organization_code ||' ('||organization_name||')' organization_name, organization_code,organization_id

    from org_organization_definitions ood

    where operating_unit = :1

    order by organization_name



    This is working fine and giving me the Inventory Organizations based on OrgIdLine form value.



    Second poplist for Subinventories related to the Inventory Org selected in the first poplist,



    In processRequest, i am binding this with the Inventory organization selected for the first poplist as shown below:



    OAMessageChoiceBean subInvBean = (OAMessageChoiceBean) webBean.findIndexedChildRecursive("Subinventory");

    subInvBean.setListVOBoundContainerColumn(0, /* bind index */ table,"OrganizationCode");

    subInvBean.setPickListCacheEnabled(false);



    This poplist is not showing any values after selecting the Inventory Organization.



    here is the query for this poplist.



    select si.secondary_inventory_name sub_inv, si.organization_id

    from mtl_secondary_inventories si,

    org_organization_definitions ood

    where ood.organization_code ||' ('||ood.organization_name||')' = :1

    and ood.organization_id = si.organization_id

    and nvl(si.disable_date,sysdate+1) > sysdate



    Can any one help on how to get the Subinventories (depending on first poplist Inv Org) related to Inventory Organization (depending on form value OrgId) inside table region.



    Thanks,
    Sree.
     
  2. sreenathpappstechnical

    sreenathpappstechnical Starter

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    10
    Location:
    dubai
    Hello All,



    I could solve this issue by following approach.



    1.Given pick list view definition to both first and second poplists.

    2. Second poplist query changed as below.



    select si.secondary_inventory_name sub_inv, si.organization_id, ood.organization_code

    from mtl_secondary_inventories si,

    org_organization_definitions ood

    where ood.organization_code = :1

    and ood.organization_id = si.organization_id

    and nvl(si.disable_date,sysdate+1) > sysdate



    3.Added transient attribute (OrganizationCodeFV) in the VO attached to table.

    4.Added Form Value bean (OrganizationCodeFV) in the table level.

    3.Modified second poplist code in PR as below to bind it to Form Value bean created above instead of first poplist bean.

    OAMessageChoiceBean subInvBean = (OAMessageChoiceBean) webBean.findIndexedChildRecursive("Subinventory");

    subInvBean.setListVOBoundContainerColumn(0, /* bind index */ table,"OrganizationCodeFV");

    subInvBean.setPickListCacheEnabled(false);

    4.in PFR, in the PPR event for first poplist, added below code to populate the transient attribute.



    if ("InvOrgChanged".equals(eventName)) {

    String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);

    XxLinesFullVORowImpl linesRow = (XxLinesFullVORowImpl)am.findRowByRef(rowReference);

    linesRow.setOrganizationCodeFV(linesRow.getOrganizationCode());

    }



    Now, the second poplist - shows sub inventories related to first polist - Inventory Org (which is again dependent poplist based on another Form Value Bean OrgIdLine).



    Thanks,

    Sreenath.
     
    Last edited: Jul 18, 2019