Iterating Values in VO and Obtaining values


Here i have created a event and I want to check whether the Account number matches

We Can Do it By various Methods

Method 1

if(“validate2”.equals(pageContext.getParameter(EVENT_PARAM)))
{

System.out.println(“Validation Event Occured”+EVENT_PARAM);
int dummyAccNo =200; //A Dummy Variable for Comparison
OAViewObject vo1 =(OAViewObject)am.findViewObject(“xxcactBankValiVO”); // Obtaining VO instance for iterating the values
System.out.println(“Vo Executed”+vo1);
xxcactBankValiVORowImpl row = null; //Assigning a variable for Row to get Attributes
vo1.getRowCount(); //Getting the Values of Row Count This is important because when FetchedRowCount() method is called
int fetchedRowCount132 = vo1.getFetchedRowCount(); //Obtaining the Fetched Row Count
System.out.println(“Value Of Fetched Row Count “+fetchedRowCount132);
RowSetIterator rowsetiterator = vo1.createRowSetIterator(“MyTestIter”);
System.out.println(“Vo Executed My Delete Ieteradfjkhnjnjshfuhj”+rowsetiterator);
if (fetchedRowCount132 > 0)
{
rowsetiterator.setRangeStart(0); //Assiging the Range
rowsetiterator.setRangeSize(fetchedRowCount132);
for (int i = 0; i < fetchedRowCount132; i++)
{

row = (xxcactBankValiVORowImpl)rowsetiterator.getRowAtRangeIndex(i); //Iterating and passing values for each row to get printed
System.out.println(“Obtaining the from Row Set Iterator”+row);
Number primaryKey = row.getAccNo();// Getting the Value of Each Attributes
Number a=row.getBalance();
int b=row.getAttributeCount();
System.out.println(“Value of Account Number”+primaryKey+” Value of Balance”+a+”Value of Attribute Count “+b);
if (primaryKey.compareTo(dummyAccNo) == 0)
{
System.out.println(“Values Match”+primaryKey);
break; // only one possible selected row in this case
}

}
}
// Always close the iterator when you’re done.
rowsetiterator.closeRowSetIterator();

}

Method 2

if(“validate”.equals(pageContext.getParameter(EVENT_PARAM)))
{
System.out.println(“Event Param====================>”+EVENT_PARAM);
OAViewObject ReqVO = (OAViewObject)am.findViewObject(“xxcactBankValiVO”);
int counter=0;
OAMessageTextInputBean a=(OAMessageTextInputBean)webBean.findChildRecursive(“TransferAccNo”);
String k=(a.getValue(pageContext)).toString(); //Obtaining Value From a messagetextinput

xxcactBankValiVOImpl vo = (xxcactBankValiVOImpl)am.findViewObject(“xxcactBankValiVO”);
if(vo!=null)
{
for (xxcactBankValiVORowImpl row = (xxcactBankValiVORowImpl) vo.first(); row!=null;row = (xxcactBankValiVORowImpl) vo.next())// Iterating the VO
{
System.out.println(“Vo.first()”+row+”sdjfjwefij”+vo.getCurrentRowIndex());
String primaryKey=(row.getAccNo()).toString();
System.out.println(“Invoice Number is “+(row.getAccNo()).toString());
if (primaryKey.compareTo(k) == 0)
{
System.out.println(“Values Match and “+primaryKey);
counter++;
break;
}

}
try{
if(counter==0)
{
OAException message = new OAException(“This is a invalid number.”,OAException.ERROR);
pageContext.putDialogMessage(message);
}
}
catch(OAException e)
{
System.out.println(e);
}

}
}

About pacesettergraam

A good and realistic person

Posted on August 5, 2013, in OAF, Oracle and tagged , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: