Sunday, September 4, 2011

ADF BC : LOV Switching in ADF BC

 

If we have a requirement to bind multiple LOV to single attribute in ADF View object then Oracle ADF BC has LOV switcher concept to achieve it.

I will use standard HR schema ,but on top of that I will create my own table to play with LOV Switch.

CREATE TABLE LOV_SWITCH (ID NUMBER(10) , LOV_RETURN_ID VARCHAR(20))

image

Two LOV

Here we are going to have two LOV one that will return department id and other that  will return employee id on single attribute ID.

We have LOV_RETURN_ID field which will be check box for triggering the switch.

When I create EO/VO for LOV_SWITCH Table it generated following VO definition and I added extra transient attribute lovswitchvar.

image

Then you can see I added two LOV one will return employee id and other department id to ID attribute. Also , I selected List of Value Switcher as lovswitchvar.

LOV Definition can be found below.

image

Employee LOV

image

If I run the application will it work ? NO

LovReturnId :- I made LovReturnId as check box and I am comparing value of LovReturnId in lovswitchervar ,if check box is clicked then use LOV_Id otherwise use LOV_Id1.

Now add groovy express to lovswitchvar.

image

Run Application Module tester.

When I click + icon first time to create row check box is unchecked.

UnCheck :-  EmployeeId in LOV.

image

Check :-  DepartmentId in LOV.

image

We have used LOV switcher in ADF BC layer , we can also used on Taskflow , Page Definition.

1 comment:

  1. Hi,
    This Looks fine. But, tell me one thing here you are giving the salary value and based on that LOV switcher is working. Consider a scenario, I have few records in the table and i am displaying all the records on page load.without that checkbox can't we swithc between LOV's. There could be a reuirement on single page I want to show two different dropdowns one should show first LOV and other should show second LOV at a time and the LOV_Switcher may not be a part of the UI

    ReplyDelete