We are going to use HR schema and when user select country drop down we will automatically populate corresponding state belonging to that country.
Let us create ADF BC component for Location table and country table.
1. Add on List of value for CountryId Field as here we are going to add country view to CountryId field and it will show us all countries in List.
Select countryId in list attribute
Then go to Hints tab and select country name that will be visible in list down.
Final look for countryId.
Now just run the application tester and we should expect country drop down. We are still not done since we have to create state LOV.
So we are seeing country LOV. next step is to create state lov and dynamically filter it based on country selected.
Create State LOV
Create new State LOV that will be readonly view object with query
select distinct from location
Instead of writing query manually we will use query builder.
Select Location table and expand it and shuttle state column and click ok.
It has automatically generated query for us. If counry is selected then state will change ,so we need to add where clause with bind variable to this State Lov that will accept CountryId for filtering purpose.
Use query builder for state lov.
Final query will look like this.
Remember we have also create bind variable with same name in state lov as below.
Add this lov to stateprovince column of LocationView and set the following.
Look carefully that we have set the bind variable to CountryId attribute of view object.so if user select Country Lov and select country then it will be passed to statelov that will apply this bind variable to filter the state based on country.
Run the application module tester and select the country and you will see automatically state Is filtered.
Now we need to create GUI based on this.
Drag and Drop location view from datacontrol to jspx page.
If we run the jspx ,it will not work.
We have to first set PartialTrigger on StateLov and make it dependent on Country Drop down change.
Also, we have to make countryId autosubmit property to true ,so when it get submitted whole page will not get refreshed and it will dynamically change state lov.
Intially statelov is null ,but when we select country then it will get populated.
Dependent LOV made simple