In this short Post we will see how to take advantage of ADF BCs to create LOVs, declaratively without writing any code.
In Employee table there is "Manager_Id" and "Department_Id" columns but no Manager Name and Department Name. Though its great from design perspective, but users will not understand the Ids. So we will have to show the Manager Name and Department Name in a drop down. As you can change your manager through LOVs, technically, it won't be wrong to say that, LOVs will save you from a grumpy Manager (pun intended)..
This is achieved through View Accessors. As the name suggests this allows one View (VO) to be accessed from another View (VO). In this case we are going to access Manager and Departments VO from Employee record. Lets see how to define View Accessors.
Goto EmployeesVO.xml -> View Accessors -> Click on Add and move both DepartmentVO (to get Department Name) and EmployeesVO (to get Manager Name) to right hand side as shown below.
This will create 2 View Accessors "DepartmentsVO1" and "EmployeesVO1".
Lets define Manager's LOV.
Now click on Attributes under EmployeesVO and click on ManagerId and then Add the LOV. This will open a dialog box titled "Create List of Values". In the List Data Sources give EmployeesVO1 and chose EmployeeId under List Attribute. Doing this you matched the Manager Id of the base EmployeesVO to the EmployeeId of the View Accessor's VO. Now click on UI Hints and chose First Name and Last Name in the Display Attributes. Finally the screens should look like below:
Similarly lets add LOV to DepartmentId also. On the EmployeesVO.xml click on DepartmentId and Click "+" icon under "List of Values" and add "DepartmentsVO1" under DepartmentId under List Attribute. Under UI Hints add DepartmentName as display field. Here both screens should look like below:
We are done, lets run the AM and double click on Employees1 or Employees4 and check the LOVs.
Lets change label to Display Manager Name and Department Name. Goto Employees VO and double click on ManagerId attribute to open Edit Attribute Window, then goto Control Hints" and enter "Manager Name" as shown below.
Similarly change DepartmentId attribute Label to "Department Name". When you run the AM now it will look like below:
This Concludes our chapter on LOV using ADF BC.
In Employee table there is "Manager_Id" and "Department_Id" columns but no Manager Name and Department Name. Though its great from design perspective, but users will not understand the Ids. So we will have to show the Manager Name and Department Name in a drop down. As you can change your manager through LOVs, technically, it won't be wrong to say that, LOVs will save you from a grumpy Manager (pun intended)..
This is achieved through View Accessors. As the name suggests this allows one View (VO) to be accessed from another View (VO). In this case we are going to access Manager and Departments VO from Employee record. Lets see how to define View Accessors.
Goto EmployeesVO.xml -> View Accessors -> Click on Add and move both DepartmentVO (to get Department Name) and EmployeesVO (to get Manager Name) to right hand side as shown below.
This will create 2 View Accessors "DepartmentsVO1" and "EmployeesVO1".
Lets define Manager's LOV.
Now click on Attributes under EmployeesVO and click on ManagerId and then Add the LOV. This will open a dialog box titled "Create List of Values". In the List Data Sources give EmployeesVO1 and chose EmployeeId under List Attribute. Doing this you matched the Manager Id of the base EmployeesVO to the EmployeeId of the View Accessor's VO. Now click on UI Hints and chose First Name and Last Name in the Display Attributes. Finally the screens should look like below:
We are done, lets run the AM and double click on Employees1 or Employees4 and check the LOVs.
Lets change label to Display Manager Name and Department Name. Goto Employees VO and double click on ManagerId attribute to open Edit Attribute Window, then goto Control Hints" and enter "Manager Name" as shown below.
Similarly change DepartmentId attribute Label to "Department Name". When you run the AM now it will look like below:
This Concludes our chapter on LOV using ADF BC.
No comments:
Post a Comment