Multi Select LOV Feature in ADF and performing search criteria through List Binding

ADF allows you to create a Multi-select LOV component,  this holds one of the advantages over the OAF technology stack where the Multiselect LOV feature is not available. 

In this tutorial, we will learn how to create Multiselect LOV values, and upon selection of values, how to pass it in search criteria to get relevant records. 

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  multi-select list of values 

2. Employee Info View Object is created to filter out the records based on the LOV selection.  Here we are not creating view criteria, instead, we will use Dynamic where clause in AMIMPL java class. 


Queries used for view objects are 


SELECT * FROM XXC.XX_BUSINESS_UNITS


SELECT * FROM XXC.XX_EMPLOYEE_INFO

Dynamic where condition used in a user-defined method in Application Module implementation class 

    public  void applyWhereCondn(String Bids)
    {
            ViewObjectImpl voins=this.getEmployeeInfo1();

            System.out.println("inside am"+Bids);
            voins.setWhereClause("BUSINESS_UNIT_ID IN("+Bids+")"); 

            System.out.println("inside am"+voins.getQuery());
            voins.executeQuery();
            if(Bids==null)
            {
                    System.out.println("inside bids null"+Bids);
                    
                    voins.setWhereClause("1=1");
                    voins.executeQuery();
                    voins.setRangeSize(-1);
                     
                }
        }



Now the drag the BusinessUnitVO on to the Page palette to create Multi-select LOV.









 Drag Table onto the Page palette.  




Enable partial triggers on the result table by providing the reference of Multiselect. 

For instance, look into below screenshot 






As we are implementing the functionality of multi-select lov and the moment value being selected at that juncture view object criteria need to display results based on the selected LOV values. For this, we need to use ValueChangeListener event. 





package tgr.oracle.apps.fnd.MultiSelectLovApplication;

import java.io.Serializable;

import java.util.Map;

import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;

import oracle.adf.model.BindingContext;

import oracle.binding.OperationBinding;

import oracle.jbo.uicli.binding.JUCtrlListBinding;

public class NewBean implements Serializable {
    public NewBean() {
    }
    public oracle.binding.BindingContainer getBindings() {
         return BindingContext.getCurrent().getCurrentBindingsEntry();
     }
    public void BusinessVCE(ValueChangeEvent valueChangeEvent) {
        // Add event code here...
        
        String BusinessId="";
        valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
        Object selval=valueChangeEvent.getNewValue();
                System.out.println("xxx-valueChangeEvent.getNewValue()"+valueChangeEvent.getNewValue());
                JUCtrlListBinding listBindings = (JUCtrlListBinding)getBindings().get("BusinessUnitVO1");
                   
                 Object str[] = listBindings.getSelectedValues();
                 System.out.println("xxx"+str.length);
                 
                    for (int i = 0; i < str.length; i++) {
                             System.out.println(str[i]);
                             BusinessId=str[i]+","+BusinessId;
                         }

                 BusinessId=BusinessId.substring(0, BusinessId.length()-1);

                 System.out.println("Value of where values "+BusinessId);
                 
                 //CALLING OPERATOR BINDING
                 if(BusinessId!=null)
                 {
                 oracle.binding.BindingContainer bindings = getBindings();
                 OperationBinding operationBinding = bindings.getOperationBinding("applyWhereCondn");
                  Map m =operationBinding.getParamsMap();
                 m.put("Bids", BusinessId);
                 operationBinding.execute();
    }
}

}


With the above code, our application is ready for testing, Let's run the page and check the output.



Here I'm selecting only two values from the multi-select lov 



Here we go, based on the multi-selection, result table displaying relevant records.






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 )