Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed sub-totals when first line of data is incomplete #37

Merged
merged 1 commit into from Mar 5, 2020

Conversation

berchierm
Copy link
Contributor

In a cross-tab, when the "sub-totals" option is enabled for a given row, but the first line of data (of the current sub-totals group) is incomplete, the feature only compute sub-totals for data having non-null data in the first row.
I think this is because of how the sub-total line is created ; cells of that new sub-total line are based on the content of the first line, so if the first line contain "blank" cells, the object is null, and because of subTotalLine[j].Element != null the content of following cells will never be added.
The code of my PR here take the possibility of having empty cells in account and will add the missing object in the sub-total at each line, and not only the first one.

Here is a view of what happens without the fix :
image
The first line and sub-totals lines missing are highlighted in orange
SQL to generate these data :
select 'Group 1' as Groups, 'Subgroup1' as Subgroups, 'Col3' as Col, 4 as value from dual union select 'Group 1' as Groups, 'Subgroup2' as Subgroups, 'Col1' as Col, 1 as value from dual union select 'Group 1' as Groups, 'Subgroup2' as Subgroups, 'Col2' as Col, 3 as value from dual union select 'Group 1' as Groups, 'Subgroup2' as Subgroups, 'Col3' as Col, 1 as value from dual union select 'Group 1' as Groups, 'Subgroup3' as Subgroups, 'Col2' as Col, 4 as value from dual union select 'Group 1' as Groups, 'Subgroup4' as Subgroups, 'Col1' as Col, 5 as value from dual union select 'Group 1' as Groups, 'Subgroup4' as Subgroups, 'Col3' as Col, 8 as value from dual union select 'Group 2' as Groups, 'Subgroup1' as Subgroups, 'Col1' as Col, 2 as value from dual union select 'Group 2' as Groups, 'Subgroup1' as Subgroups, 'Col3' as Col, 6 as value from dual union select 'Group 2' as Groups, 'Subgroup2' as Subgroups, 'Col1' as Col, 1 as value from dual union select 'Group 2' as Groups, 'Subgroup2' as Subgroups, 'Col2' as Col, 2 as value from dual union select 'Group 2' as Groups, 'Subgroup2' as Subgroups, 'Col3' as Col, 4 as value from dual union select 'Group 2' as Groups, 'Subgroup3' as Subgroups, 'Col3' as Col, 1 as value from dual

Below is a view of the same report with the fix :
image

Feel free to test, edit, correct or ignore if what I did is wrong and contact me if needed.
Regards

@ariacom ariacom merged commit 2ae7294 into ariacom:master Mar 5, 2020
@ariacom
Copy link
Owner

ariacom commented Apr 9, 2020

Note that the 5.5 offers a new Advanced Property on the measure element:
'Set empty cells to zero'

ariacom added a commit that referenced this pull request Sep 18, 2020
Fixed sub-totals when first line of data is incomplete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants