Oracle OAF: Loop through a VO

The following piece of code is an example of how we can loop a View Object (VO) and do something:

   public void processFormRequest(OAPageContext pageContext,
                               OAWebBean oawebbean) {
                             
           super.processFormRequest(pageContext, oawebbean);  
  
           OAApplicationModule rootAM = pageContext.getRootApplicationModule();                                 
           
           if (pageContext.getParameter("ReviewBtn") != null) {
                                       
            OAViewObject ReqVO2 =
                (OAViewObject)rootAM.findViewObject("NegTeamMembersVO");
  
                if (ReqVO2 != null) {
         
                    Row ReqRow2 = ReqVO2.first();      
                if (null != ReqRow2) {          
                    int idx = ReqVO2.getRowCount();
                    int approverCounter = 0;
                  
                    for (int xx = 0; xx < idx; xx++) {
                        if (null != ReqRow2) {
                           if(ReqRow2.getAttribute("ApproverFlag").toString().equals("Y")){
                               approverCounter++;
                           }
                           ReqRow2 = ReqVO2.next();
                        }
                    }
                    if(approverCounter==0){
                        throw new OAException("XXERR", "XXERR_AT_LEAST_ONE_APPROVER", null,
OAException.ERROR, null);                                        
                    }
                }
            }
           }                               
        }

Leave a Reply