Friday 14 October 2011

Loop Throught the Fetched Records in VO

Example 1:
 
This particular example was written for Oracle Sourcing.
       OAApplicationModule rootAM = pageContext.getRootApplicationModule();           
       OAViewObject ReqVO   =      (OAViewObject)rootAM.findViewObject("BidHeaderSectionsVO");
           
            if (null!=ReqVO) {
                Row ReqRow = ReqVO.first();           
                if (null != ReqRow) {
                           
                int idx = ReqVO.getRowCount();
   
                for (int xx = 0; xx < idx; xx++) {
                    if (null != ReqRow) {
                       // Do some work....
                       ReqRow = ReqVO.next();
                    }
                    else {}
                }
              }
            }
Example 2:
OAViewObject vo = (OAViewObject)getPPVCMHeadersVO2();
   PPVCMHeadersVORowImpl row = null;
   int fetchedRowCount = vo.getRowCount();
   RowSetIterator insertIter = vo.createRowSetIterator("insertIter");
   if (fetchedRowCount > 0)
    {
     insertIter.setRangeStart(0);
     insertIter.setRangeSize(fetchedRowCount);
     for (int i = 0; i < fetchedRowCount; i++)
      {  
        row = (PPVCMHeadersVORowImpl)insertIter.getRowAtRangeIndex(i);
        row.setAttribute("Sno",new Integer(i+1));
      }
    } 
  insertIter.closeRowSetIterator();

No comments:

Post a Comment