Contact : oafqueries@gmail.com (OAF/ADF Trainings and Customizations)

Tuesday, July 5

How to loop through the VO Rows in ADF

Hi,

In this example we will make use of a simple button to invoke a method in AM and in that method we will loop through the VO Rows. The same can be utilised in noumerous situations where you need to loop through the VO Rows as the page submits.

Step 1) Write a method loopVORows in Application Module

public void loopVORows ()
{
ApplicationModule am = (ApplicationModule) Configuration.createRootApplicationModule("sapient.oracle.model.InvoiceAM","InvoiceAMLocal");
InvoiceVOImpl vo = (InvoiceVOImpl) am.findViewObject("InvoiceVO1");
if(vo!=null)
{
for (InvoiceVORowImpl row = (InvoiceVORowImpl) vo.first(); row!=null;row = (InvoiceVORowImpl) vo.next())
{
System.out.println("Invoice Number is "+row.getInvoiceNum());
}
}
}




Step 2) Double Click on Application Module and under Client Interfaces shuttle the method defined above in the avaliable methods for client.









Step 3) Referesh the DataControl so as to reflect the new method and then drag and drop the new method from the datacontrols to the JSF page and create a ADF Button.








Step 4) Run the page. The output will look like :





Step 6) Click on the button and in the jdev console you will see the SOP printed.





Thanks,
Gaurav

No comments:

Post a Comment