Sunday 14 January 2018

How to check the Value of View Object(VO) all Columns during Run Time of OAF Page.



Hi Freinds , In this post i am sharing you one trick this can be very helpull in your Extension of OAF page. If you are doing any Controller or View Extension or doing any kind of Debugging of any error in OAF page , i am sure this trick will help you allot in your requirment.


You have to just put you code in the controller against the View object for which you want to know its complete details.

With the help of System.out.println() & PageContext.writeDiagnostics() function you can print every thing about the view object in the oaf page and you will get a good understanding of the object and you can do extension in right way.

      
OAApplicationModule am = pageContext.getApplicationModule(webBean);

   ViewObject vo = am.findViewObject("SupplierVO");
          if (vo!=null) {
vo.executeQuery();

              while (vo.hasNext()) {
                      Row row = vo.next();
          String rowDataStr = "";

 // To Check How many attributes (columns) is the View Object using?

                      int numAttrs = vo.getAttributeCount();
                      // Column /Attributes numbers start with 0, not 1.

                      for (int columnNo = 0; columnNo < numAttrs; columnNo++) {
                        // See also Row.getAttribute(String name).
                        Object attrData = row.getAttribute(columnNo);
                        rowDataStr += (attrData + "\t");
                      }
                      pageContext.writeDiagnostics(this,rowDataStr,2);
                       System.out.println( "Data of View Object SupplierVO:"+rowDataStr);
                   }
}
 

0 comments:

Post a Comment

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *