Tuesday 8 April 2014

ADF : Making three level dependent LOV (List Of Values)

Hello all,

During the development we often come across a scenario in which we need to filter the List Of Values dependent on other List Of Values. Suppose you want only the cities of the selected country.

Here am about to show how we can make a three level dependent ListOfValues.
I will make a LOV which the user will select a location from locationLOV , then the other departmentLOV will show the department of the selected location, then the user will select a department and the employeeLOV will show the Employees of the selected department.

So, I have created an ADF application and made a connection to HR Schema. Also created three viewObject LovDepartmentVO,LovLocationsVO and LovEmployeeVO to make LOV's.

Now our main purpose is to filter the department on the basis of locations and employees on the basis of department.

For that we have to create a viewCritria in DepartmentsVo to filter departments on the basis of locations.


And then create view criteria for EmployeesVO.


Now we have viewObjects for LOV ready, we need to make a viewObject on whose attributes we will put these lovs.

So here I am creating a query from dual.
And then add three transient attributes as location , department and employees.
Make sure that property "updatable" is true.


Select locationsTrans and go to List of Values and add the lov by selecting LovLocationsVO.
Select departmentTrans and make a lov from lovDepartmentsVO.
Now go to view Accessors tab of the TemporaryVO you will see the lovs added to temporaryVO, now select the lovDepartment and click on edit button.

Select the viewCritera and in the bind value parameters select locationsTrans as value. This will filter the departments Lov on the basis of selecetd location.

Now add the lov on employeesTrans too and then go to viewAccessors select and mapp the bindVarible value to departmentTrans.



Now create am Applicaiton Module and add temporaryVo to AM and create a page and drag all the three attributes in the page and run the application.

Run the page and Select LocationTrans as London, then you will see DepartmentTrans filtered and you will see only 'Humar Resource' department in the lov as it resides in London. And in EmployeeTrans you will see Employees of Selected  department.


Make sure that the all the attribute have their autosubmit attribute to 'true' and attributes are partial trigged on basis of the source.

And the most important thing is that this technique will work on when the three attributes are on the same viewObject.. like in this case is the TemporaryVO.

You can Download the sample from here DependentLovTest.jar

If you have any questions regarding this, feel free to ask.






No comments:

Post a Comment