1 Reply Latest reply on May 27, 2009 4:59 AM by *Prashant Shelke*

    Show precission (.00) in OLAP DataGrid

    Varun Bajaj (PHP)

      Hi,

       

      I need to display precission value in OLAP dataGrid basically (.00). I know mathamtically 2 and 2.00 are same but in a project i need to display 2.00 rather then 2. I am using OLAP dataGrid.

       

       

      any help is heartly welcome.

       

      thanks in advance,

       

      Varun Bajaj

        • 1. Re: Show precission (.00) in OLAP DataGrid
          *Prashant Shelke* Level 4

          Hi,


          I think you have to go for NumberFormatter & labelFunction(can be applied on any dataGridColumn you want)


          <mx:NumberFormatter id="numberFormatter" precision="2" /> <!-- here number formatter defined -->

          <mx:DataGridColumn labelFunction="formatAmount" .... />


          public function formatAmount(value:Object,column:DataGridColumn)  : String /** this function you have to call as labelFunction **/
          {
              try
              {       

                  /* value is nothing but column data, in your case 2 which we have to show as 2.00

                  **/
                 

                  if(value != null && value != "" || value != "-")
                      return numberFormatter.format(value);
                  else
                      return "-";
              }
              catch(error : Error)
              {
                  Alert.show("error : "+error.getStackTrace());
              }
              return "";
          }


          OR


          you have to iterate a data & need to process each amount under numberformatter


          Thanks.

          1 person found this helpful