Home DevShare Designing BIRT Reports

BIRT Dynamic Number Formatting

Share

by Yaytay

Forum - 100 postsDevShare - 5 postsLeaderboard - 10 timesPoll Voter
Posted 30 Oct 2011 - 01:22 PM

(0)  (0)   (514 views)

Tip for controlling number formatting dynamically

Birt Version:-3.7,2.6

If you have a number format that changes for each row in your report this approach keeps the Data item numeric so it can be rendered to a spreadsheet and manipulated as a number.

In the OnRender event for the Data element add a script to modify the data format, i.e.:

var currency = this.getRowData().getColumnValue('Currency');
this.getStyle().numberFormat = currency + "###0.00{RoundingMode=HALF_UP}";

See here for more details.

 
Filter More