How to prevent exponential notation in DynamicText for large numbers in BIRT #2282
Replies: 5 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
|
Hi @speckyspooky, Thanks for your response! Yes, you're absolutely right—I’m currently using BIRT Version 4.8.0. Unfortunately, the project I’m working on isn’t ready for an upgrade at this time, so I’m looking for a workaround that would work within this version. I noticed from your screenshot that while the Excel export seems to handle the numbers correctly, the BIRT Viewer still displays them in exponential notation. Does this mean that even in Version 4.21.0, the viewer still has this issue? Also, I’d really appreciate your help with one more thing. Would you be able to share a JavaScript snippet that dynamically generates a DataElement instead of using DynamicText? I’ve tried implementing this myself, but ran into several issues. If possible, could you use the .rptdesign file I attached earlier and show how to convert the DynamicText to DataElement controls? This would be incredibly helpful in resolving the formatting issue while keeping the data type intact for Excel exports. Thanks again for your time and support! |
Beta Was this translation helpful? Give feedback.
-
|
Instead of dynamically generating content to the report, what I do in cases like this (table with dynamic number of columns) is to create the maximum number of columns in the designer (if needed, with a list around this, if there are more columns than fit on one page), then just hide the unneeded columns using visibility expressions. |
Beta Was this translation helpful? Give feedback.
-
|
@speckyspooky can you share the rptDesign of your change |
Beta Was this translation helpful? Give feedback.
-
|
@speckyspooky thanks for the file. Just need your acknowledgement for the following. DynamicText control will display large numbers in exponent (scientific) notation when its content type is set to plain. Unfortunately, there is no way to override this behavior. If we use a format specifier or change the content type to html or auto, the numbers will display correctly. However, the limitation is that the numbers are internally treated as strings, and when exported to an Excel file, they will be saved as strings rather than numeric values. |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
-
Hello BIRTians,
I’m currently working on a BIRT report that involves a dynamic table, where the number of columns varies based on user configurations. While I’m aware that a CrossTab could handle this scenario, I’m unable to use that approach due to certain constraints (which I’d prefer not to elaborate on here).
To work around this, I’ve implemented a solution using JavaScript in the beforeFactory event, and I’ve managed to get most of it functioning as expected. I’m using the DynamicText control to render numeric values. However, I’ve encountered an issue where numbers with more than 7 digits are automatically displayed in exponential notation.
For example:
I understand that using a formatter like this can resolve the display issue: (new Packages.java.text.DecimalFormat("#,##0.00")).format("1234567891235.99") or set the dynamic text control content to html
However, this introduces a new problem when exporting the report to .XLSX format—the numbers are treated as strings in Excel cells, which affects downstream processing and formatting. ( check the screenshot )
Is there a way to prevent exponential notation while still preserving the numeric type in Excel exports ?
Any suggestions, workarounds, or best practices would be greatly appreciated. I’ve attached the .rptdesign file for reference. Please let me know if any additional information is needed.
Tagging @speckyspooky and @hvbtup for your insights, your input would be incredibly helpful!
Thank you in advance!
DynamicTablePOC.zip
Rendering as exponent issue

Number treated like string in excel issue

Beta Was this translation helpful? Give feedback.
All reactions