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.
Thanks
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
what is the difference between using ViewCriteria or setWhereClause and this way of filtering.
ReplyDeleteViewCriteria is used also for filtering rows in table and you can also apply viewcriteria to original viewobject.
DeletesetWhereClause you use it to add where criteria to where clause of viewobject.
the main benefit of using where clause it doesn't affect the current row set iterator.
DeleteWhat is the difference between using getFilteredRows() method than using RowMatch() ? Any pros and cons?
ReplyDelete