Home > Blogs > Creating Dependent LOVs in ADFbc

Creating Dependent LOVs in ADFbc

Let me demo how can we create the dependent LOVs in ADFbc  here. We can define the dependent LOVs on Region, Country, Location (Country LOV depends on Region and Location LOV depends on Country LOV ) using the HR Schema.

 

1)      Create the EOs, VOs for the below tables of the HR schema as shown in the below screen-shots.

Region,Country,Location.

2)  Then goto CountryVO and goto Query tab. Add a bind variable ‘region_id’ and mark the data type as ‘Long’ and unmark the ‘Required’ check box.

 

3) Create a view criteria which filter only the countries for a region. To create VC, open CountryVO and  click on ‘+’ that shown against the View Criteria section.  Select the Attribute as ‘RegionId’ , Operator as ‘Equals’, Operand as ‘Bind Variable’.In the parameter dropdown, select the bindvariable ‘region_id’ and click on Ok.

4)      Goto LocationVO and  goto Query tab.Add a bind variable ‘country_id’ and mark the data type as ‘String’ and unmark the ‘Required’ check box.

 

5) Create a view criteria which filter only the Locations for a country.To create VC, open LocationVO and click on ‘+’ that shown against the View Criteria section.

Select the Attribute as ‘CountryId’ , Operator as ‘Equals’, Operand as ‘Bind Variable’.In the parameter dropdown, select the bindvariable ‘country_id’ and click on Ok.

 

6) Create a test vo called ‘TestDependentLOVVO’ by right click on your project and select ViewObject. Select ‘Read only access through SQL query’ option while creating the VO. As this is a test vo, we are creating a read-only VO.

 

7) Do not enter any SQL and go to Attributes section. Add the attributes Region,Country,Location by click the ‘New’ buttons. Make sure that for these attributes the type is ‘String’ and the updatable property set to ‘Always’.

 

8) Similarly create the Id attributes like ‘RegionId’, ‘CountryId’, ‘LocationId’. Make sure that the type of ‘RegionId’ and ‘LocationId’ is ‘Long’ and the datatype for the ‘CountryId’ is ‘String’. The updatable property should be set to ‘Always’.

 

9) In the ‘ApplicationModule’ window of the ‘Create View Object’ wizard, select the ApplicationModule check box and create a new ApplicationModule called ‘TestDependentLOVAM’ and then click on ‘Finish’.

 

10) Now create the view accessors for the Regions,Countries,Locations in the ‘TestDependentLOVVO’. Open the VO and goto ‘View Accessors’ tab and click on ‘+’. In the View Accessors window, select the RegionVo from the available view object and shuttle to ‘View Accessors’ section. Similary, shuttle CountryVO, LocationVOs to the ViewAccessors section and press ‘Ok’ button.

 

11)Now edit the ‘CountryVA’ and shuttle the view criteria ‘CountryVOCriteria’ and pass the ‘RegiondId’ value of the VO to the bind variable of the ‘CountryVA’.

12) Similarly, edit the ‘LocationVA’ and shuttle the view criteria ‘LocationVOCriteria’ and pass the ‘countryId’ value of the VO to the bind variable of the ‘LocationVA’.

13) Now create LOVs on Region, Country, Locations in the ‘TestDependentLOVVO’. Select the Region attribute from the Attributes tab and goto ‘List-of-values’ section and click on ‘+’. In the create LOV window, select the ListDataSource as ‘RegionVA’ and the ListAttribute as ‘RegionName’. In the ListReturnValues’ section retrun RegionId,RegionNames.

 

14) Then goto ‘UI Hints’ tab of the ‘Create LOV’ window, select DefaultType as ‘Choice List’ or ‘Combo box with List of values’. Select the attributes you want to dispaly in the LOV.

15) Similarly, create the LOVs on Country, Location attributes as shown in the below screen-shots.

 

16) Now run your VO in the ‘TestDependentLOVAM’ and click on ‘+’. Select the Region as ‘Europe’. The country lov shows only the countries for the selected region. Select any country and select the ‘Location’ lov. Now the Location lov shows the locations of the selected country.

 

Download Sample application  : DependentLOV

Advertisements
Categories: Blogs
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: