Create Filter or Criteria List of Values (LOV) in Oracle ADF

In this post i will show you how to create LOV with View Criteria. Do the following steps:-


1) Create View Object
2) Add Bind Variables to Views
3) Create View Criteria
4) Finally Create LOV


This post the enhancement of previous post and in this post we will create LOV on Manager ID field. We are going to add two business rules on Manager ID LOV:-


1) Manager cannot manage themselves i.e ( EmployeeId <> CurrentEmployeeId)
2) Employee can be manage by other employees in the same department or in Executive Department which ID is 1. (DepartmentId = 1 OR (DepartmentId = CurrentDepartmentId))


Creating View Object


Right click on adf.demo.modle.quries package and select New View Object





Change name as EmpManagerLOV 




Move Employee View from Available to Selected area and un-check the updatable option. 





On Attribute page choose DepartmentId, EmployeeId, FirstName and LastName




On Query page choose Order by as FirstName and LastName




Adding Bind Variables to View


On EmpManagerLOV.xml go to Query tab page and in the Bind Variables section create two bind variables:-


1) CurrEmpID and its Type Number Required No
2) CurrDeptID and its Type Number Required No




After two Bind Variables your Bind Variable Section should look like




Creating View Criteria


In View Criteria click Add Button. Enter the Criteria Name as EmpManagerLOVCriteria click the Add Item button along with Group and choose the settings as shown in the slide to complete the 1st Rule required (EmployeeId <> CurrentEmployeeId)




To add 2nd Rule, Select the top-level node EmpManagerLOVCriteria and click Add Group button and select new group node and set the Conjunction as AND.

Click Add Item and set the expression as DepartmentId = 1. Select the AND Group node and click Add Item again. set all fields as shown in the slide





After adding Rules your View Criteria Section look like




Creating LOV


On the Attributes Tab of  EmpView.xml select ManagerId entity and create List of Value.




Add a List Data Source item, and select EmpManagerLOV, Change the Name to EmpManagerLOVAccessor and move it to the View Accessors area




Select the EmpManagerLOVAccessor and press Edit on the Top. Move the EmpManagerLOVCriteria to the Selected area. In the Bind Variables Section enter the values for both Variables as shown




Set LOV Configuration as shown






Go to UI Hints Screen and do the following settings




On Employee.jspx page delete ManagerId field Drag and Drop ManagerId from Data Control and choose List of Values as ADF LOV Choice List




Finally right click and Choose Run on Employee.jspx page, click Manager ID LOV item




Press Search link appearing in the LOV ADF will open a pop to display all values. You can filter your values





Comments

Post a Comment

Popular posts from this blog

What is Oracle Integration Cloud Service - ICS?

How to Create Packages in Oracle Database using TOAD for Oracle

How to create a Simple Scheduler Job in Oracle Database using Toad