Home
Analytics
formatting dynamic text
burtondav
I have the following expression in Expression Builder:
Total.sum(row["regularhrs"])
It is a summary of regular hours worked.
The output often looks like 2.874635348506
I want it to two decimal places.
But, when the cell is dynamic text, I don't see a Properties selection for formatting number.
I tried this:
valueOf format="#.00"(Total.sum(row["regularhrs"]))
But, BIRT didn't like that.
How can I format the dynamic text to be 2 decimal places?
Thanks
Find more posts tagged with
Comments
Megha Nidhi Dahal
Hi burtondav,<br />
<br />
You will not get the number format option because the type of the data in <strong class='bbc'>dynamic text</strong> can be anything (or string). A workaround that I suggest you is to use <strong class='bbc'>Data</strong> instead of <strong class='bbc'>dynamic text</strong>, but this will work only if the value is of the same type every time.<br />
There you can specify the type of data as decimal. Now you should get the format option.<br />
<br />
Hope it helps.<br />
<br />
regards<br />
Arpan
johnw
A dynamic text component is basically a dumb expression component, it will just drop the result of whatever expression you have, with no Binding created to a table. Since it won't have a Data Type, it won't have a formatting property. The easiest way to format that would be, as suggested, to use a Data element instead. If you have a good reason for not using a Data report item, you can always use the Java formatters in the java.text package. things like the SimpleDateFormat and SimpleNumberFormat classes will do what you need.
John