OracleAppsDNA

RowSetIterator in OAF: Usage of Row Set Iterator to Traverse VO Rows

RowSetIterator

It is the interface for Row Set Iterator. A Row Iterator is an iterator over a collection of View rows or Entity rows.

Usage

import oracle.jbo.Row;
import oracle.jbo.RowSetIterator;

    public void rowTraverse() {

        //VO Instance
        XXLkpCodesVOImpl vo = getXXLkpCodesVO1();

        //Row Instance
        XXLkpCodesVORowImpl row = null;
        int rowCount = vo.getFetchedRowCount();

        //RowSetIterator Instance
        RowSetIterator saveItr = vo.createRowSetIterator("saveItr");
        if (rowCount > 0) {

	        //Set row range to zero, to traverse from beginning of VO rows collection
            saveItr.setRangeStart(0);
            saveItr.setRangeSize(rowCount);

            for (int i = 0; i < rowCount; i++) {

                row = (XXLkpCodesVORowImpl)saveItr.getRowAtRangeIndex(i);
                this.writeDiagnostics(this, 
                                      "XX In AM - LkpCode  " + row.getLookupCode(), 
                                      2);
            }

        }
		//Close row set iterator. 
        saveItr.closeRowSetIterator();
    }

Note: Its suggestible to use only RowSetIterator while traversing through VO rows. Instead, if we use VO object to traverse through VO rows using vo.first() or vo.next() functions, there is more possibility that row data might get changed.

Exit mobile version