Showing posts with label OAF. Show all posts
Showing posts with label OAF. Show all posts

Friday, July 15, 2016

RowSetIterator (OAF)

RowSetIterator (OAF)

The interface is part of oracle.jbo.
It is an iterator over a collection of View rows or Entity rows.

Most common use of the interface is to work on table regions where logic involves navigating row by row and working on the table data.

Example 1: Analyze project column value being null or not null on iProc checkout page.
Here the RowSetIterator is opened, fetched to the number of rows in the table and loops for each row to perform required task before closing the RowSetIterator.

The screen looks as below for reference.


Edit cart Screen - iProc showing advanced table region
Following code is part of processFormRequest and includes import statements as well for reference.

import oracle.apps.fnd.framework.OAViewObject;
import oracle.jbo.RowSetIterator;
import oracle.jbo.domain.Number;
import oracle.apps.icx.por.req.server.PoRequisitionLinesVORowImpl;

OAViewObject PoReqLinesVO = (OAViewObject)am.findViewObject("PoRequisitionLinesVO");


RowSetIterator rsi = null;

int totalRowCount = 0;

rsi = PoReqLinesVO.createRowSetIterator("rsi");

PoRequisitionLinesVORowImpl billingrowimp = null;
totalRowCount = PoReqLinesVO.getFetchedRowCount();

if (totalRowCount > 0)
{
 rsi.setRangeStart(0);
 rsi.setRangeSize(totalRowCount);

 for (i=0; i<totalRowCount; i++)

{
 billingrowimp = (PoRequisitionLinesVORowImpl)rsi.getRowAtRangeIndex(i);
         if (billingrowimp != null)
           {
              if (billingrowimp.getProjectNumber() != null)
               {<PERFORM TASK HERE>}
            }
         }
  rsi.closeRowSetIterator();

Using FND_MESSAGE in OAF Page

Using FND_MESSAGE in OAF Page

Define message in application:

You can use Application Developer - Message to create a message text. Alternatively using Functional administrator - Core Services - Messages you can create a new message as well.


Define Message
To use the message in the page controller file, use the below piece of code in processFormRequest or wherever your logic requires.

throw new OAException("<APPLICATION SHORT NAME>", "<MESSAGE_CODE>", null, OAException.ERROR, null);

This will show an Error message as long as the conditions are met on the page.