Dynamic View Object Creation

Dynamic View Object Creation



We can use below code if need to create a VO(View Object) dynamically in OAF page.


String loguser = pageContext.getUserName();
       

         String query8 = "select  FULL_NAME " +
         "from PER_ALL_PEOPLE_F PAPF,FND_USER FU " +
         "where FU.EMPLOYEE_ID=papf.person_id " +
         "and sysdate between PAPF.EFFECTIVE_start_DATE " +
         "and PAPF.EFFECTIVE_end_DATE   " +
         "and FU.USER_NAME='"+ loguser +"'";  
          
         ViewObject QueryVO8 = null;
         QueryVO8 = am.findViewObject("XxTestVO");
         if (QueryVO8 != null) 
         {
             
              QueryVO8.remove();
         }
         
         QueryVO8 = am.createViewObjectFromQueryStmt("XxTestVO", query8);
         QueryVO8.executeQuery();
         
         
         if (QueryVO8 != null && QueryVO8.first() != null && QueryVO8.first().getAttribute(0) != null) {
         
             
             String RequestorName1 = QueryVO8.first().getAttribute(0).toString();
             
             OAMessageTextInputBean cname = (OAMessageTextInputBean)webBean.findChildRecursive("CreatedUserName");
             cname.setValue(pageContext,RequestorName1);
          
         }
       

Post a Comment

0 Comments