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);
        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);
        totInvoiceColumnBean.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter);

1 comment:

  1. Hi Santhosh,

    Sorry to bother you.
    I could able to resolve the number formula issue, but i have to format these numbers.
    i.e. say
    the data is as below
    emp salary
    abc 10000
    efg 20000
    xyz 30000

    this i could able to display, but i need to display as below

    emp salary
    abc 10,000.00
    efg 20,000.00
    xyz 30,000.00

    i had a page with the data in advanced table region with a view object EmpVO and VO column names as emp and salary and advance table column id's as empName and sal.
    and the salary is of oracle.jbo.domain.Number type (not int/float/double...).

    I apologize if I am asking too much.

    Thanks in advance,