Wednesday, 27 July 2011

Number Formatting in OAF.......



Call this method from ProcessRequest (-----,------) method

  private void setNumberFormatter(OAPageContext pageContext, OAWebBean webBean)
   {
      Formatter formatter = new OADecimalValidater("$#,##0.00;($#,##0.00)", "$#,##0.00;($#,##0.00)");
      OAMessageStyledTextBean sumOfColumn = (OAMessageStyledTextBean)webBean.findChildRecursive("SumOfInvoices");//Id of the Item
      OAColumnBean sumColumnBean = (OAColumnBean)webBean.findIndexedChildRecursive("SumOfInvoicesColumn"); // Id of the Column
      if (sumOfColumn != null)
      {
        sumOfColumn.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);
        sumOfColumn.setAttributeValue(CURRENCY_CODE,"USD");
        sumColumnBean.setAttributeValue(CURRENCY_CODE,"USD");
        sumColumnBean.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);
      }
      OAMessageStyledTextBean totInvoiceAmount = (OAMessageStyledTextBean)webBean.findChildRecursive("TotalInvoiceAmount");
      OAColumnBean totInvoiceColumnBean = (OAColumnBean)webBean.findIndexedChildRecursive("TotalInvoiceAmountColumn");
      if (totInvoiceAmount != null)
      {
        totInvoiceAmount.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);
        totInvoiceAmount.setAttributeValue(CURRENCY_CODE,"USD");
        totInvoiceColumnBean.setAttributeValue(CURRENCY_CODE,"USD");
        totInvoiceColumnBean.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);
      }
   }

No comments:

Post a Comment