Anil's Blog is Best Viewed on GOOGLE CHROME

Saturday, November 3, 2012

Dynamically enabling Totaling in Advanced Table

Dynamically enabling Totaling in Advanced Table

Oracle provide the functionality of Totaling for a column by 'Recalculate' button. This means whenever user updates the value of column, user have to click on 'Recalculate' button to see the updated value in Total bean.

We got a business requirement where it has to be happen automatically as soon as user tabs out of the amount field and to achieve this we have enabled a event (fire partial event) and checked in code that whenever this event gets fired, we looped through the View Object rows and set the updated value in Total Bean.

Here is the code that we have written to achieve this.

public void processRequest(OAPageContext pageContext, OAWebBean webBean)


   super.processRequest(pageContext, webBean);

   if(pageContext.getSessionValue("ApplyTotal")!=null) {

       setTotal(pageContext.getSessionValue("ApplyTotal").toString(),pageContext,webBean) ; // Calling setTotal method to set the updated total value in Total Bean.


public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


super.processFormRequest(pageContext, webBean);

OAApplicationModule am = pageContext.getApplicationModule(webBean);

 if("updateTotal".equals(pageContext.getParameter(EVENT_PARAM))) //Total event fired

         OAViewObject vo = (OAViewObject)am.findViewObject("XXCreditCardVO1");
         Integer total  = 0;
         while(vo.hasNext())  // Loop through VO rows

             total = total + Integer.parseInt(vo.getCurrentRow().getAttribute("BilledAmount").toString());
        pageContext.putSessionValue("ApplyTotal",total);  // Putting the value in session
        pageContext.forwardImmediatelyToCurrentPage(null,true, "Y");

public void setTotal(String total, OAPageContext pageContext,OAWebBean webBean){

OAAdvancedTableBean tableBean = (OAAdvancedTableBean)webBean.findChildRecursive("


if(tableBean != null)


OAColumnBean tableFooterBean = (OAColumnBean)tableBean.findChildRecursive("ReimbAmountClmn"); 

if (tableFooterBean != null)


OAMessageTextInputBean totalBean = (OAMessageTextInputBean)tableFooterBean.findChildRecursive("ReimbAmount");

if (totalBean != null)


String formattedTotal = total.toString();

totalBean.setAttributeValue(TABULAR_FUNCTION_VALUE_ATTR, formattedTotal);






No comments:

Post a Comment

Note: Only a member of this blog may post a comment.