Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 277914 - Numbers not formatting as currency when using it as a Style
Summary: Numbers not formatting as currency when using it as a Style
Status: VERIFIED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.3.2   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: 3.7.0   Edit
Assignee: Birt-Report-inbox@eclipse.org CLA
QA Contact: mindan xu CLA
URL:
Whiteboard: Obsolete
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-26 13:58 EDT by SuperTime CLA
Modified: 2011-05-26 13:33 EDT (History)
3 users (show)

See Also:


Attachments
Sample Report (151.19 KB, application/octet-stream)
2009-05-26 13:58 EDT, SuperTime CLA
no flags Details
Style applied on MSRP data element (151.89 KB, application/octet-stream)
2009-08-10 10:23 EDT, SuperTime CLA
no flags Details
simple report (27.54 KB, application/octet-stream)
2010-11-18 04:00 EST, Xiaoying Gu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description SuperTime CLA 2009-05-26 13:58:01 EDT
Created attachment 137202 [details]
Sample Report

Build ID: M20090211-1700

Steps To Reproduce:
1. Take any sample report (see attached) and add a new Style Named "Currency Symbol". 
2. Apply the style to field named "MSRP" which is of type float. 
3.Preview the report in the preivew tab as well as the birt viewer, notice the formatting does not apply.

Note: If you apply currency formatting directly to the field named ["MSRP"] by (select field -> properties->format number) it works just fine. The issue is the formatting is not being applied when it is applied as a style.

More information:
Comment 1 Rick Lu CLA 2009-05-27 01:27:13 EDT
Can you please try BIRT 2.5.0 build? I tried to set the font color blue in Style "CurrencySymbol".  It worked out.
Comment 2 SuperTime CLA 2009-05-27 12:53:29 EDT
The font color setting in the Style does work for me too. The issue is with the Format Number option. 
I don't have 2.5.0 installed so I cannot try that out.
Comment 3 Rick Lu CLA 2009-05-31 02:10:56 EDT
What's meaning "The issue is the formatting is not being applied when it is applied as a style." ?
Comment 4 SuperTime CLA 2009-06-01 10:00:40 EDT
This means, if I select the column and goto format number use currency formatting it works. But If I select the column and apply the style "CurrencySymbol" then I cannot see the currency format on previewing the report. 
Note: the CurrencySymbol style is configured for format number option as type currency.
Comment 5 Rick Lu CLA 2009-06-01 23:28:19 EDT
(In reply to comment #4)
> This means, if I select the column and goto format number use currency
> formatting it works. But If I select the column and apply the style
> "CurrencySymbol" then I cannot see the currency format on previewing the
> report. 
> Note: the CurrencySymbol style is configured for format number option as type
> currency.
> 

Checked the report, the format in Style CurrentcySymbol is:

           <structure name="numberFormat">
               <property name="category">Custom</property>
               <property name="pattern">&#65533;###,##0.00</property>
           </structure>

while, the format in the MSRP cell is 

            <structure name="numberFormat">
                <property name="category">Currency</property>
                <property name="pattern">#,##0.00</property>
            </structure>

You can see that the format in the style is "Custom", can you please try to set it "Currency" too?

Comment 6 SuperTime CLA 2009-08-10 10:23:37 EDT
Created attachment 143909 [details]
Style applied on MSRP data element

Please see the attached sample report. Notice I have updated Number format of the style to Currency with a dollar symbol. And the style has been applied to the MSRP data element on the report. When I cilck on the preview tab I do not see the style being applied to the data element. 
However if you go back to the report layout and apply the style at the table level and then preview the report, it works.

So the issue is that if the style is being applied at the data element level, it does not work. But if the style is applied to the table level, it then works.
Comment 7 Rick Lu CLA 2010-05-05 03:32:24 EDT
(In reply to comment #6)
> Created an attachment (id=143909) [details]
> Style applied on MSRP data element
> 
> Please see the attached sample report. Notice I have updated Number format of
> the style to Currency with a dollar symbol. And the style has been applied to
> the MSRP data element on the report. When I cilck on the preview tab I do not
> see the style being applied to the data element. 

The report has some issues. Please remove line 996 to 998. 

     <structure name="numberFormat">
         <property name="category">Unformatted</property>
     </structure>

If this snippet exists for MSRP data, it won't use the numberFormat in style "CurrencySymbol".

BTW, can you please try latest BIRT 2.6.0 build?
Comment 8 Xiaoying Gu CLA 2010-11-18 03:59:25 EST
Format number by style works on build 2.6.2.v20101118-0630.
Set as fixed.
Comment 9 Xiaoying Gu CLA 2010-11-18 04:00:10 EST
Created attachment 183368 [details]
simple report
Comment 10 mindan xu CLA 2010-11-24 01:50:56 EST
Verify the bug