This week i will continue my last post about Creating LOV in ADF application and today i will create LOV on ManagerId Column which is different cause of 2 reasons
We would add following 2 business rules to the 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 90.
(DepartmentId = 90 OR (DepartmentId = CurrentDepartmentId)
For this we have to create a View Criteria on our ViewObject (VO) that will filter the list based on few Bind Variables.
Creating View Object (VO):
- Create new VO in adf.demo.model.queries package called EmpManagerLOV based on Employee entity with updateable is deselected.
- On Attribute page choose DepartmentId, EmployeeId, FirstName and LastName on Query page choose Order by as FirstName and LastName.
Adding Bind Variables to VO:
- Double click the VO EmpManagerLOV go to Query tab page in the Bind Variables section click the green + sign and Create 2 bind variables.
- Name CurrentEmployeeId Type Number Required No
- Name CurrentDepartmentId Type Number Required No
Creating View Criteria:
- In View Criteria click Add Button (Green + sign)
- 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 i.e (Department = 90 and DepartmentId = CurrentDepartmentId) Follow these steps
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 = 90” with a Validation of
“Required.” Operand set as “Literal” in this case.
- Select the “AND Group” node and click Add Item again. set all fields as shown in the slide.
- Click OK
- Your screen would look like as in the slide
- Double click the EmployeeVO in attributes page click on the ManagerId and In List of Values Section click Add + button
- Add a List Data Source item, and select “EmpManagerLOV.”
Change the Name to “EmpManagerLOVAccessor” and move it to the View Accessors
- Select the EmpManagerLOVAccessor and press Edit on the Top
- Move the EmpManagerLOVCriteria to the Selected area.
- In the Bind Variables section double click the value section and enter both values for both Variables as
For CurrentDepartmentId enter DepartmentId
For CurrentEmployeeId enter EmployeeId
Click OK and Rest you can follow same steps as in my last post or just follow slides.
- Set LOV Configuration as in the slide
- Your Design Page would be like this
- Right click and Choose Run on Employee.jspx page you will see something similar to this click Manager ID LOV item
Thats all for today
You can Download my completed example
Dont forget to check these 2 amazing Books about ADF