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.
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'.
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'.
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
No comments:
Post a Comment