Friday, March 10, 2017

Creating LOV in ADF Application



This week i will continue to enhance my previous post (Moving to Jdeveloper11g Your First ADF Form) and today i will cover how to create LOVs in Oracle ADF application.

Pre-requisites:
- HR Schema in Oracle database.
- Download this basic completed application and change the connection settings according to your environment.


Objective:
On this post we will create LOVs for Job, Department Id in Simple Employee based form.
Note: (Manager LOV is little tricky i will cover in next post)


Steps to follow:
For good naming convention we will rename the adf.demo.model.view package to queries
- Right click on adf.demo.model.view in Model project and choose Re-factor > Rename and rename it to adf.demo.mode.queries


Adding Departments and Jobs Entities:
Note: If you already have entities in your project then you can skip to next step

- Add Departments Entity by Right clicking on adf.demo.model.entities package in Model project and choose New Entity Object
Enter Name as "Departments" and Choose Schema object as "Departments" by pressing Browse button you can select from the list of objects as well.


- Choose All columns in attributes page and click Finish.
- Repeat the same step for Jobs entity.

Adding View Objects for Departments and Jobs LOVs :

- Right click on adf.demo.model.queries package and Choose New View Object.

- Enter name as "DepartmentsLOV" and other options as shown in the slide.
- Select the Departments Entity and Move to selected area uncheck the option Updatable.
- Select Department Name and Id Attributes to Selected area.

- Choose Departments Name in Order by section by pressing EDIT button you can select from List.
- Click Finish.
- Repeat same steps for Jobs Choose JobId and JobTitle as Attributes and JobTitle as Order by.


Creating LOVs:
 
- Double click EmployeeVO in adf.demo.model.queries section.
- Select DepartmentId attribute in the attribute page and Click "+" green button at the bottom under List of Values section.
- Click the green + button with List Data Source.
- Select DepartmentsLOV in Available Objects change the Name at the bottom to DepartmentsLOVAcesssor and Press > button to Create Accessor for LOV as shown in the slide click OK.

- Choose DepartmentId in List Attribute Return Values will populate automatically. Your Screen should similar to this.



- Go to UI Hints tab Leave the List type as Choice List (There are many type of LOVs available)
- Move Department Name from Available to Selected Area.
- Choose "Labeled Item(First of List)"  at very bottom include "No Selection.."  and set the Description as "


- Click OK
- Repeat Same Steps for JobId attribute.

Your EmployeeVO page should looks like this


Linking LOVs to JSF Page:
- Open employee.jspx page in View Controller Project
- Delete JobsId and DepartmentId attribute by selection them in Structure Window and Right click choose Delete.
- Refresh the DataControl page
- Expand the DataControl > EmployeeVO select DepartmentsId attribute and Drag and Drop it to FormLayout.
- Menu will appear select Single Selection > ADF One Choice List as shown in the slide
- Repeat the same step for JobId.
Your JSF Page should looks like this


- Right click and Choose Run

Your Page should looks like this on Runtime

Conclusion:
With Oracle ADF application development becoming fast easy and see how easy is to create LOVs in your ADF application as like in Oracle Forms.

No comments:

Post a Comment

Oracle Fusion - Cost Lines and Expenditure Item link in Projects

SELECT   ccd.transaction_id,ex.expenditure_item_id,cacat.serial_number FROM fusion.CST_INV_TRANSACTIONS cit,   fusion.cst_cost_distribution_...