Skip to main content

In-Memory Filtering Without Affecting Default Row Set

Noticed the following requirement (multiple times) while working with ADF developers - Find out rows in the default row set that meets specific conditions - In other words, perform in-memory filtering without affecting the primary row set.
By default, when you apply in-memory filtering  using ViewCriteria or RowMatch, they are applied on default row set.The following code snippet may help you to perform in memory filtering without affecting your default row set-
 CountriesViewImpl countriesViewImpl = (CountriesViewImpl)getCountriesView1();  
 //Define VC for in-memroy filtering  
 ViewCriteria vc = countriesViewImpl.createViewCriteria();  
 ViewCriteriaRow vcr1 = vc.createViewCriteriaRow();  
 vcr1.setAttribute("CountryName", "LIKE A%");  
 //Override 'protected' findByViewCriteriaForViewRowSet in CountriesViewImpl  
 //and mark it as 'public' so that client can call this API  
 RowIterator rowIter =  
      countriesViewImpl.findByViewCriteriaForViewRowSet(getCountriesView1().getDefaultRowSet(), vc, 50,  
                                                                   ViewObject.QUERY_MODE_SCAN_VIEW_ROWS, null, null);  
      //Work with filterered rows  

Updated on August 2013

Note: JDeveloper 12C has new feature called Row Finder, which will help you to achieve the above mentioned functionality. It is recommended to us the same if you are on 12C release


For a programmatic VO, how can i handle the VC ?
Jobinesh said…
Take a look at the sample attached in this post
Srinivas Chavali said…
Hi, I have a question related to in-memory filtering of view rows.

We have a programmatic View Object which gets data from 3 different rows and populate them in view rows (We have overridden standard methods like executeQueryForCollection..etc)

The data is displayed in a ADF table.

Now when the user filters data, normally filter works fine but the web service calls are made every time the filters are applied/removed.

We would like to avoid making calls to web services when user filters data by setting Query Mode to "QUERY_MODE_SCAN_VIEW_ROWS".

But what happens is first time filter is applied, the filtered rows are displayed properly but from there on the query collection refers to filtered data only and not the complete data set.

So when the user removes filter and hits enter again only filtered rows are displayed and not all the rows fetched initially. I am not sure why the query collection looses all the rows and keeps only filtered rows??
Anonymous said…
Any work around for Srinivas's issue?
Anonymous said…
How to put these filtered rows back in UI ? like in poupup which shows the filtered rows only?
Darshan Punjabi said…
Thank you Jobinesh...This post helped me a lot...
Bhargav Prasad said…
Hi Jobinesh,

In terms of filtering in-memory rows, how findByViewCriteriaForViewRowSet is different from findByViewCriteria. Even the later won't affect default rowset, if I'm not wrong.


Popular posts from this blog

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…

Happy New Year 2018 !

We can't go back and change the beginning, but we always can start where we are and change the ending. Believe in yourself and you will be unstoppable!

Wishing you and your family a very happy new year 2018 !!!