Birt changing by script the number format in one column table

43 Views Asked by At

In a Birt report I'd like to change the number format depending on the data values.

I tried this in onRender of the table's script to test how changing format programmaticaly :

var df = new Packages.java.text.DecimalFormat("#,###.000000");
df.format(row["tensionEcm1"]);

There is no effect on the column display. Any ideas?

1

There are 1 best solutions below

0
hvb On

df.format is a function that returns the formatted value as a string. You are calling this function, but you throw away the result!

What you should do: Take your JS as is, but remove the final semicolon ;, and use this as an expression for a dynamic text item (with content type "Plain").