Set multiple LOV’s on attribute and conditionally switch using LOV Switcher

Sharing is Caring

This post is about a very basic and common use case
Suppose we have to show different values in our List depending on some condition but all values must be stored in the same attribute so for this type of requirement ADF BC framework provides the concept of LOV Switcher
The framework allows us to define multiple LOV on the same attribute, I hope you all know about defining LOV(List of Values) so move ahead and see how to use LOV switcher.

See the implementation part-

    • Created a Fusion Web Application and a view object to show LOV on viewport (Used dual to create a view object for this example, you can use your own)

 

    • Created 2 more viewObject to apply LOV on first view object’s attribute, One ViewObject is for Departments and another one is for Employees

 

 

    • Open dual viewObject select LovAppl attribute and goto ListOfValues tab and add both LOV
      For Department – DepartmentId is List Attribute and DepartmentName will be shown on UI

 

For Employees- EmployeeId is List Attribute and FirstName, LastName will be shown on UI

    • Now click on green plus icon of List Of Values Switcher and add a transient attribute, this will be further used to switch LOV on the base of some condition

 

 

    • So created LovSwitcher attribute, and remember this switcher attribute value should be one of the LOV Name that is applied on the attribute.
      Here I am using a condition – if the LovType attribute of Dual viewObject is ‘D’ the LovAppl should show Departments Lov and if it is ‘E’ then LovAppl should show Employees Lov
      For this, I have written expression for lov switcher attribute
      LovType==’D’ ? ‘LOV_LovAppl’ : LovType==’E’ ? ‘LOV_LovAppl1’ : null

 

LOV Switcher

 

  • Now run Application Module and check it

 

Thanks, Happy Learning 🙂

Related Posts

An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF

0 thoughts on “Set multiple LOV’s on attribute and conditionally switch using LOV Switcher”

  1. I have same requirement but I need to show multiple records and multiple selectonechoice for each record on same page, for this I used ListView component I almost achieve this requirement but multiple selectonechoice not reflecting it just shows first selectonechoice for each line.

Leave a Reply

Your email address will not be published. Required fields are marked *