formatString not working

Help
2006-10-15
2013-05-20
  • Half Abude Scheidl

    Hello,

    I`ve been working on formatString, however I couldn't get it to work. It simply doesn't change anything in my charts!
    The simplest formatString I tried was : formatString="$#,##" (is this correct). I also tried a more complex, with styles, obtained at this forum, but it also didnt work.
    I've tried a lot of things: upgrading jfreechart.jar, upgrading jpivot, changing locale...
    Seeing log generated by Jpivot it seems that openi receives correct information, but ignores it:

                <Cell CellOrdinal="13">
                  <Value xsi:type="xsd:double">50</Value>
                  <FmtValue>50</FmtValue>
                  <FormatString>$#.##</FormatString>
                </Cell>

    Does anyone has any idea about this? I would be very grateful.

     
    • Half Abude Scheidl

      Please, does anyone have any further information? It is important for me.
      Thanks in advance.

       
    • Bart Pappyn

      Bart Pappyn - 2006-10-18

      As far as I know, formatString is not used in charts. 

      You have to understand that a cell has two things : the actual value and the formatted value.

      The first being mostly numeric, the second is a string.

      While it would be a great idea that the axes are decorated with formatted values, it is a thing that would not work in all cases, since the full scale is not always available as data and the for the in-between values, the chart component does not know how to format them.

      I also want formatted values in my charts, but it is not here for the moment.

       
    • Half Abude Scheidl

      Ok, thanks for the information. I am not so worried about charts at this moment, but the point is: I couldn´t make it work even on the data being displayed in the tables... This feature works for you?  

       
    • paul lucas

      paul lucas - 2006-10-18

      I have entered bug:1579816

       
    • nadia aziz

      nadia aziz - 2009-09-10

      Hi,

      I have not yet managed to make this work either? No formatting in the tables are available.
      I am using openI 2,

      thanks

      nadia

       
  • noblomov

    noblomov - 2009-10-03

    Hi,

    I'm still having problems with formatString. Is it supposed to be working ?
    If yes, what are the format options / how do I use it?

    Thanks,

    N.

     
  • Andre Richards

    Andre Richards - 2009-10-07

    I have also been struggling to get OpenI to use the formatString for numbers without success, and I could not find any documentation on this issue, so I looked at the source code.

    OpenI gets the locale of the user, and uses this to format the number - I am not sure where this locale gets set (is/should it be configured in the app on the user account, does it pick it up from the browser, etc.).

    This obviously has the advantage of displaying numbers in the correct locale, but does not solve my problem of controlling the number of fraction digits to display (I am showing revenue, and the fraction is meaningless and just uses up space).

    Unless AS/OLAP/Mondrian/XMLA has some way of specifying just the number of fraction digits to display, without having to specify the full format (e.g. similar to Java's NumberFormat which has a property MaximumFractionDigits), I am not sure that there is an easy way to both support localisation and hide fractions.

    In the meantime, I have changed the code to bypass the locale formatting, so at least my current users should be happy. Anybody out there that might know if it is possible to supress fractions without specifying the formatString?

    The code change I made was in (v2.0RC2) **org.openi.olap.xmla.XmlaUtil**. In the **formatNumber(Object value,String fmtValue)** method I changed this line:
       
         if(FacesContext.getCurrentInstance()!= null) {

    to:
       
         if(fmtValue == null &amp;&amp; FacesContext.getCurrentInstance()!= null){

    At first I just always returned the fmtValue as is, but I got NullPointerExceptions, so now it basically executes the format code as before if fmtValue is null else just returns fmtValue as is. I have tested this, and have not found any issues with it so far.This is obviously a work-around, and probably not in line with OpenI's thinking, but I'm not sure if there is any other way to achieve this.

     
  • noblomov

    noblomov - 2009-10-08

    Hi,

    If I understand you correctly, bypassing the local formatting with the code's modification you describe in your last comment allows you to have formatString correctly working ?

    N.

     
  • Andre Richards

    Andre Richards - 2009-10-08

    Correct

     
  • nadia aziz

    nadia aziz - 2009-10-23

    Hi,

    I have an issue with displaying a number with the percentage symbol agianst it. For eg, 8.5%, in place of % it puts d or n. I think it is linked to the fact that this is a calculated field, and d and n means if the decimal is recurring or not. Anyhow, I am unable to display the % symbol. And also, I am trying to achieve coloring the field background to be red or green depending on valus greater than x. I have included the IIf( condition) in the Mondrian schema. BUt this does not work either. Any pointers?? Thankyou

    Nadia

     

Log in to post a comment.