Overview
In Oracle ADF, you can easily implement the association drop-down list or lov through the row-level binding described in the previous article, but in AF: Query, the dependencies in the view object attribute can be used to conveniently associate the lov. This article mainly introduces the implementation of associating the lov in AF: query.
Requirement
The locations table in HR Schema records the region and country information. Here, we use region and country as examples to implement two lov, associate the two lov, and add them to AF as criteria: query component.
Implementation
1. Create an ADF Application
2. Create an entity object and view object based on the locations table in the HR schema, create an application module, and add the instance of the newly created view object to the data model of the application module.
3. To add a lov to the locationsview (view object), you must first modify its SQL statement, add related fields, and use the EXPERT mode to modify the SQL statement of locationsview (view object) as follows:
Select locations. location_id, <br/> locations. street_address, <br/> locations. postal_code, <br/> locations. city, <br/> locations. state_province, <br/> locations. country_id, <br/> C. country_name, <br/> C. region_id, <br/> r. region_name <br/> from locations, regions R, countries C <br/> where R. region_id = C. region_id <br/> and C. country_id = locations. country_id
4. Create entity object and view object for the regions and countries tables respectively. The view objects are named regionsview and countriesview respectively.
5. add criteria to countriesview as the lov query condition for the countryname attribute in locationsview
6. Because the selection of countryname needs to be restricted by regionid, add the variable binding restriction"
7. Set the feasibility of the Bind Variable (bv_regionid) to false. The BIND variable is not displayed on the page.
8. Add view accessor to locationsview. Add regionsview to selected without modification. Then add countriesview. Add the newly created criteria to the selected area of view criteria and set row-level binding. The variable (bv_regionid) created in the previous step is similar) associate with the regionid attribute in the locationsview to filter countries data.
9. Add list of value (LOV) to the regionname attribute in the locationsview to complete the corresponding attribute settings:
10. Similarly, add list of value (LOV) to the countryname attribute in the locationsview to complete the settings of the corresponding attribute:
11. After setting, you need to set the dependency between related attributes. Because regionid in locationsview depends on regionname changes, you must first set the dependencies attribute of regionid to regionname.
12. Similar to Step 11, in locationsview, the change of countryname is caused by the change of regionname or regionid. Therefore, set the dependencies attribute of countryname to regionname or regionid, and set it to regionname here.
13. Create criteria for locationsview as the query condition for the page created in the next step. The query conditions include regionname and countryname.
14. Create a new page, use the criteria created in the previous step as the AF: Query condition, and reasonably layout the result set table
15. Save the application and run it.
Running result:
Click regionname:
Select Americas. In this case, the countryname is the country of Americas, and the original countryname is cleared:
Countryname is cleared. Click countryname:
Check that the filter is successful. Select the corresponding option for query:
This article is transferred from Oracle Seeker: http://oracleseeker.com/2009/11/13/adf_afquery_cascade_lov/