05 August, 2012

ADF : Filter View Object Rows

In this post I explain how to filter rows in ViewObject and RowSetIterator.
Primarily, filter the rows means return a set of rows from ViewObject or RowSetterator according specific criteria which is filtered in memory only.

1- Filter ViewObject

     //Get ViewObjectImpl object  
     ViewObjectImpl vo = getDeptVO();  
       
     //Filter using specific attribute value  
     Row[] filteredRows = vo.getFilteredRows("AttributeName", "AttributeValue");  
   
     //Filter using RowQualifier Class  
     //Use RowQualifier if you have more than one condition in filtering rows  
     RowQualifier rowQualifier = new RowQualifier(vo);  
     rowQualifier.setWhereClause("AttributeName=AttributeValue");  
     filteredRows = vo.getFilteredRows(rowQualifier);  

2- Filter RowSetIterator

     //Get ViewObjectImpl object  
     ViewObjectImpl vo = getAllAdvisorView();  
          
     //Get RowSetIteratorImpl object  
     RowSetIterator rsIterator=vo.createRowSetIterator(null);  
       
     //Filter using specific attribute value  
     Row[] filteredRowsRSI = rsIterator.getFilteredRows("AttributeName", "AttributeValue");  

Thanks

4 comments:

  1. what is the difference between using ViewCriteria or setWhereClause and this way of filtering.

    ReplyDelete
    Replies
    1. ViewCriteria is used also for filtering rows in table and you can also apply viewcriteria to original viewobject.

      setWhereClause you use it to add where criteria to where clause of viewobject.

      Delete
    2. the main benefit of using where clause it doesn't affect the current row set iterator.

      Delete
  2. What is the difference between using getFilteredRows() method than using RowMatch() ? Any pros and cons?

    ReplyDelete

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...