Sunday 24 November 2013

Obtaining Row Reference from a radio Button

reate a row button on table region  by select Selection When we click the radio Button a action will be fired. That we can obtain in CO and process in AM. This is very useful in Master Detail Relationship
Here we get a value by the radio Box check and we will pass to AM and we pass the obtained value to a VO as a param.
 Code in CO to obtain the row reference
String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);    //Obtaining the Row Reference of the current Row
OAApplicationModule am1 =(OAApplicationModule) pageContext.getApplicationModule(webBean);
Serializable[] s={rowReference};//    Sending the parameter thro a Serializable parameter
am1.invokeMethod(“obtainRow”, s);//invoking the Method in AM
Code in AM to process  the row reference
public void obtainRow(String rowRef)

{
OAViewObject vo = (OAViewObject)getxxCustVO();
OARow row = (OARow)findRowByRef(rowRef); //Getting the rowRefence and getting as a row
System.out.println(“VO Current Row “+ vo.getCurrentRowIndex()+” “+row.getAttribute(“SelectFlag”));
if (row!=null)
{
System.out.println(row.getAttribute(“CustomerId”));
Number CustNum = (Number)row.getAttribute(“CustomerId”); //Obtaining Value from a Attribute and storing in a variable
// int CustNum = Integer.parseInt(custNum);
System.out.println(“VO getAttribute “+CustNum);
OAViewObject addrvo = (OAViewObject)getxxCustAddrVO();
addrvo.setWhereClause(“Customer_id = :1″);
addrvo.setWhereClauseParams(null);;
addrvo.setWhereClauseParam(0,CustNum);
addrvo.executeQuery();
}

No comments:

Post a Comment