fix: handle empty cell values in JSON and CSV exports when hide group value selected #1404
+18
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What the change is
This PR fixes a bug where the "Hide Group Amounts" filter option in Account Reports (Balance Sheet, Profit & Loss, Trial Balance, General Ledger) was not being respected during CSV and JSON exports. When this option was enabled in the report UI, group account balances were correctly hidden from display, but the export functionality would still include the raw values in the exported file.
The fix ensures that:
When "Hide Group Amounts" is enabled and a report is exported to CSV or JSON, group rows will have empty values for balance columns instead of exporting the underlying numerical amounts
The exported data now matches what the user sees in the UI, providing consistency between display and export
Both CSV and JSON export formats are updated to respect this setting
How it works
The export functions in commonExporter.ts were previously using the rawValue property of report cells for all exports, ignoring the display value that already had the hideGroupAmounts logic applied.
The fix adds a check: if a cell's display value is empty (indicating hideGroupAmounts was applied) and it's a group row, the cell is exported as an empty string instead of using the rawValue. This ensures the exported data respects user-configured visibility settings.
Changes made:
Updated convertReportToCSVMatrix() function - CSV exports now check if a group row has an empty display value and export accordingly
Updated getJsonData() function - JSON exports now apply the same logic for consistency
Testing notes
This is a straightforward behavioral fix that makes exports consistent with the UI display. The change is minimal and focused on the specific issue. Manual testing can be performed by: