In this Example shows View Criteria define for BatchId, Filtered records for relevant batch by passing batchId.
1)First thing is you have to create a View Object in mine TraineeVo
2)In TraineeVO Select Query and add bind variable in mine batchId
3)Press + Sign for add View Criteria and make criteria as follows
4)Add method for AppModuleImpl class to execute View Criteria In mine
public void executeTraineeBatchId(String batchId) {
ViewObjectImpl traineeVO = this.getTraineeVO(); //relaventVO
traineeVO.setNamedWhereClauseParam("batchId", batchId); //bindVariable name and pass value
traineeVO.setApplyViewCriteriaName("TraineeVOCriteriaForBatchId"); //criteriaName
traineeVO.executeQuery(); //executeVO with Criteria
}
5)To expose this method to ViewController must add to client interface in AppModule
And press SaveAll
6)Refresh the Data Controls and check whether it available in relevant AppModule
7)Now in View Criteria in data control > TraineeVO > Named Criteria can drag to page as “ADF query panel with Table” but here example is using bean class.
To access View Criteria must “executeTraineeBatchId” bind to page
Click Bindings>+>methodAction>and Create action binding
8)Add InputText and Command button and in Action listener of button get batchId and execute view criteria as follows
public void searchBtnAl(ActionEvent actionEvent) {
String batchId = ""+itBatchId.getValue();//get batchId
if (batchId != null && !batchId.equals("")) {
executeSearchCriteria("executeTraineeBatchId", "batchId", "" + batchId);
}
}
private Object executeSearchCriteria(String sCriteria, String sParamName, String sParamVal) {
BindingContainer bindings = getBindings();
OperationBinding ob = bindings.getOperationBinding(sCriteria);
Map params = ob.getParamsMap();
params.put(sParamName, sParamVal);
return ob.execute();
}
public BindingContainer getBindings() {
return BindingContext.getCurrent().getCurrentBindingsEntry();
}
See Results
No comments:
Post a Comment