Oracle Applications Framework (OAF)-Dependent Message Choice List in an Advanced Table

In this article, let us understand how to achieve dependent list in an advanced table where one of the fields of each row of the table should show different list based on the other dependent list's selected value.

Use Case Scenario (Problem Statement):

State is the first message choice list in an advanced table. City is the second message choice list (dependent on State) in an advanced table. City list should show the values based on selected state for each row differently.

Solution:

  1. Create a New VO for State list- XxStateListVOSample Query: SELECT state_id, state_name FROM xx_states;
  2. Create a New VO for City list- XxCityListVO by binding (positional) the state_id which would be the filter criteria for cities list.Sample Query: SELECT city_id,city_name,state_id FROM xx_cities WHERE state_id=:1;
  3. Add instances of both VO's to the Application Module.
  4. Now on the page create an advanced table region with your preferred id eg: advancedTableRN with State (eg: stateItem) and City (eg: cityItem) as the columns with type as Message Choice.
  5. For stateItem messageChoice, set the below properties. Picklist View Instance: XxStateListVO1 Picklist Display Attribute: StateNamePicklist Value Attribute: StateIdAction Type: Fire Partial ActionEvent: stateSelectEventSubmit: True
  6. For cityItem messageChoice, set the below properties.Picklist View Definition: xx.ora.apps.loc.XxCityListVO (complete path of VO Definition)Picklist View Instance: XxCityListVO1 Picklist Display Attribute: CityNamePicklist Value Attribute: CityId
  7. Write the below code in the Process Request of respective page controller.OAMessageChoiceBean stateBean= (OAMessageChoiceBean)webBean.findChildRecursive("stateItem");stateBean.setPickListCacheEnabled(Boolean.FALSE);OAAdvancedTableBean locTable = (OAAdvancedTableBean) webBean.findChildRecursive("advancedTableRN");OAMessageChoiceBean cityBean=(OAMessageChoiceBean) locTable .findChildRecursive("cityItem");cityBean.setListVOBoundContainerColumn(0,locTable ,"stateItem");
  8. Write the below code in the Process Form Request to catch the State Selected Event and execute the city VO query.xxLocAMImpl locAm = (xxLocAMImpl) pageContext.getApplicationModule(webBean); String event = pageContext.getParameter(EVENT_PARAM); String rowRef = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);Row currentRow = locAm .findRowByRef(rowRef); if ("stateSelectEvent".equals(event)){ String stateId = currentRow.getAttribute("StateId")!=null? currentRow.getAttribute("StateId").toString():null; locAm.filterCities(stateId); }
  9. Write the below code to declare the above invoked method "filterCities" in the application module implementation java file.public void filterCities(String pStateId){ XxCityListVOImpl cityVo = getXxCityListVO1(); cityVo .setWhereClauseParam(0,pStateId); cityVo .executeQuery(); }

要查看或添加评论,请登录

Reddy Rajesh Reddy Abbarapu的更多文章

社区洞察

其他会员也浏览了