Custom Search Criteria ADF Page through List Binding


This article will emphasize List Bindings and how using List Bindings we can set the search criteria in ADF Application. 


To Implement the List Binding criteria page, First Application needs to be created and after that create Business Components like View Objects, Application module 

The sample application which created for the demonstration of Listbinding contains two view objects 

1. Business Unit View object  which will display a list of values 

2. Employee Info View Object is created with View criteria and binding parameter to         display the data based on the LOV selection 







Queries used for view objects are 


SELECT * FROM XXC.XX_BUSINESS_UNITS


SELECT * FROM XXC.XX_EMPLOYEE_INFO


Once View criteria are created, then add below code in AMIMPL java code 


 public void SearchCriteria(int BuId)
    {
        ViewObjectImpl vo= this.getXxEmployeeInfoView1();
        ViewCriteria vc =vo.getViewCriteria("XxEmployeeInfoViewCriteria"); // criteria name 
       vo.setNamedWhereClauseParam("BuId", BuId); // pass the variable name defined in the criteria
       vo.applyViewCriteria(vc);
       vo.executeQuery();
        
    }

Once added, the interface class needs to be created  so that it can used for Method bindings 





To render this view object on to the page, Let's drag view object from Data control on to the page palette, by doing so bindings will be created. 

I have dragged Select one choice, button and result set  




Create Managebean java class and on the search button write below code which enables search button functionality to filter out records based on the LOV  selection





package tgr.oracle.apps.fnd.ListBindingApp;

import java.util.Map;

import javax.faces.event.ActionEvent;

import oracle.adf.model.BindingContext;

import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;

import oracle.jbo.uicli.binding.JUCtrlListBinding;

public class SearchListBean {
    public SearchListBean() {
    }
    BindingContext bctx =BindingContext.getCurrent();
    BindingContainer bc=bctx.getCurrentBindingsEntry();
    public void SearchBtnEvt(ActionEvent actionEvent) {
        // Add event code here...
        System.out.println("hello");
        OperationBinding ob =bc.getOperationBinding("SearchCriteria");
  JUCtrlListBinding lst=(JUCtrlListBinding)bc.get("XxBusinessUnitVO1");
        System.out.println(lst.getSelectedValue());
        int k= (Integer.parseInt( lst.getSelectedValue().toString()));
        System.out.println(k);
        
        Map m = ob.getParamsMap();
         m.put("BuId",k);
         ob.execute();

     

    }

}


 In the above manage bean code, to access list binding JUCtrlListBinding is used and through this List, the binding map needs a parameter of VO binding to fetch values from the LOV.  For instance, look into below code snippet and understand  how  XxBusinessUnitVO1 used from the screenshot .


JUCtrlListBinding lst=(JUCtrlListBinding)bc.get("XxBusinessUnitVO1");



With the above code, our application development is completed. Now let's run the application and verify whether our functionality is working fine or not. 



Select the Business unit id and Click on the Search button to find the desired results. 






Comments

Post a Comment

Popular posts from this blog

REST integration built-in OIC to read Large files with size more than 10MB

Basic Concepts of OAF (Oracle Applications FrameWork )