BIRT Dynamic Number Formatting

Virgil Dodson
Virgil Dodson E admin
edited July 28, 2021 in Analytics #1
If your number formatting is user specific or needs to be passed in using a parameter, then you need to do some extra work to make this dynamic. There are probably more that one way to do this but the example below is one way.<br />
Using a Text control on a BIRT report, you can add code similar to below to dynamically change the number formatting at runtime.
&lt;VALUE-OF&gt;
if (params&#91;"numberFormat"].value == true) {
df = new Packages.java.text.DecimalFormat("#,###.00");
} else {
df = new Packages.java.text.DecimalFormat("#,###");
}
df.format(row&#91;"CREDITLIMIT"]);
&lt;/VALUE-OF&gt;
Warning No formatter is installed for the format ipb