Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Formatting numbers depend on report parameter
kosta
Hello BIRT community,
I am using common table with columns as data report items.
The data shown in the columns are floats.
My question is, can I make the number formatting depend on report parameter i.e.
if the report parameter "test" has the value 2 the data should have 2 decimal places shown like 1,00 and if the report parameter "test" has the value 1 the data should have 1 decimal places shown like 1,0 and so on.
Thanks in advance,
Kosta
Find more posts tagged with
Comments
jhelbling
Hello kosta,
A code similar to this one in the OnPrepare method of your element should allow you to do it :
if (params["test"] == "1")
{
this.getStyle().numberFormat = "#,##0.0";
}
I hope it helps.
kosta
Thanks jhelbling,
that was the right hint that helped me a lot.
At the beginning I had problems with the locale because I didn't knew that the formatting should always be defined as used in the English locale (the definition of "," and "." can be found in the java doc of - java.text - Class DecimalFormat).
The translation of the ","-sign into the "."-sign and of the "."-sign into the ","-sign is done by the locale itself (I m using German locale).
Thanks again and cheers,
Kosta