How to create Filter or Criteria List of Values (LOV) in Oracle ADF

Hi!
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

Advertisements

About Oracle Technology Blogs
Oracle Application Development

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: