Anil's Blog is Best Viewed on GOOGLE CHROME

Friday, December 3, 2010

Dependent LOV in OAF

In this article we are going to create Dependent LOV [List of Values] without writing a single line of code.

Below are the two list of values – LOV we are going to create. Supplier is an independent Lov and SupplierSite would be the dependent to Supplier one.
.
  1. Supplier LOV
  2. Supplier Site LOV

User has to select value in SupplierLov first then only user can select value in SupplierSiteLov.

If user will try to select value in SupplierSiteLov without selecting any value in SupplierLov then error message will come like:



♣  SupplierLOV will be based on SupplierLovVO.

Query for SupplierLovVO :-

   SELECT A.SUPPLIER_ID, A.NAME, A.ON_HOLD_FLAG
   FROM FWK_TBX_SUPPLIERS A

  SupplierSiteLOV will be based on SupplierSiteLovVO.

Query for SupplierSiteLovVO : -

  SELECT B.SUPPLIER_ID, B.SUPPLIER_SITE_ID, B.SITE_NAME
   FROM FWK_TBX_SUPPLIER_SITES B




Ist Step:  In this step we will create SupplierLOV

Here are the steps to create SupplierLov.

  1. In the PageLayoutRN of page*, create a region of type messageComponentLayout.
Now right click on this region and select Item of type messageLovInput & set these property:

ID                                            : SupplierName. 
Search Allowed                        : True
Selective Search Criteria           : True
Prompt                                     : Supplier Name

When a you create a messageLovInput item, JDeveloper automatically creates an inline LOV region (listOfValues style) & Lov mapping for this item.
           
* Here I am assuming that you have created one page, ViewObjects, ApplicationModule.









  1. Select the listOfValues region, right-click and select New > Region Using Wizard to quickly create your results table and bind it to the view object you created above.
 Here SupName#, OnHoldFlag would be item of type messageStyledText and ISupplierId would be type of formValue [Hidden Item].  

            Set the Search Allowed property of SupName# to True for the result table item corresponding to the LOV field on the base page.

  1. Select the messageComponentLayout region, right-click and select New > messageLayout.
 ID                                            : HiddenFieldLayoutRN
           
      Now right-click on messageLayout and select New > item of type formValue
      ID                                            :SupplierIDFV
                       


     
      4.  Ist Lov Mapping:

LOV Region Item                     : SupName
Return Item                              : SupplierName
Criteria Item                             : SupplierName

*** Special Lov Mapping start here****
IInd Lov Mapping:

Lov Region Item                       : ISupplierId
Return Item                              : SupplierIDFV

*** Special Lov Mapping end here****


2st Step:  In this step we will create SupplierSiteLOV

Here are the steps to create SupplierSiteLov.

  1. Select the messageComponentLayout , right-click and select New > select Item of type messageLovInput & set these property:

ID                                            : SupplierSiteName. 
Search Allowed                        : True
Selective Search Criteria           : True
Prompt                                     : Supplier Site Name

When a you create a messageLovInput item, JDeveloper automatically creates an inline LOV region (listOfValues style) & Lov mapping for this item.
           

  1. Select the listOfValues region, right-click and select New > Region Using Wizard to quickly create your results table and bind it to the view object you created above.

Here SupSiteName, would be item of type messageStyledText and IISupplierId would be type of formValue [Hidden Item]

            Set the Search Allowed property of SupSiteName to True for the result table item corresponding to the LOV field on the base page.
    
      3.  IIIrd Lov Mapping:

LOV Region Item                     : SupSiteName
Return Item                              : SupplierSiteName
Criteria Item                             : SupplierSiteName

***Special Lov Mapping Start here****

IVth Lov Mapping:

Lov Region Item                       : IISupplierId
Criteria Item                              : SupplierIDFV – Created in first step  

Vth Lov Mapping:

Lov Region Item                       : SupSiteName
Criteria Item                             : SupplierName - First messageLovInput ID
Required ��                            : True
Programmatic Query ��          : True  

*** Special Lov Mapping end here****


�� Set the Required property to True for Criteria Items whose values must be populated before the LOV can be invoked (if not, the OA Framework displays an error message in the LOV window).


�� Set the Programmatic Query property to True for any Criteria Items whose values you want to apply to the WHERE clause programmatically. Tip: you might use this approach; for example, if you have supplemental Criteria Items whose values should be used for partial matches instead of the default OA Framework behavior of an exact match (remember that the LOV field value itself is always used for a partial match).



Final look of Supplier & Supplier Site Lov on page & in Jdeveloper:





Thanks
--Anil

9 comments:

  1. Its not working

    ReplyDelete
  2. Thank you for this post. It did not work as explained in this post but it definitely helped.
    The developer also need to look into Dev guide for more details.

    ReplyDelete
  3. it is very good but there is a mistake
    in IV th lov mapping
    here use SupplierIDFV as criteria item
    instead of return item

    ReplyDelete
  4. Very Well Explained , thanks a lot. It saved my time and life too.

    ReplyDelete
  5. I am very very greatful to Anil for the above artical.

    ReplyDelete
  6. hi..

    what is Programmatic Query exactly do please let me know....

    ReplyDelete

Note: Only a member of this blog may post a comment.