Summarizing data from a nested databands nested databand.
-
- Posts: 7
- Joined: Wed Feb 10, 2016 12:48 pm
Summarizing data from a nested databands nested databand.
So i have 3 tiers of databands like this
- Grandparent
-- Parent (master is Grandparent, nested databand)
--- Child (master is Parent, nested databands nested databand)
The data is also related in a similar way, parent has a id relationship to grandparent, and child has a id relationship to parent.
In the Child data there is values I want to summarize, first in the parent, then in the grandparent.
An example
- Grandparent, Grandchild sum = 10 (1+2+3+4)
-- Parent, Child value sum = 3 (1+2)
--- Child, value = 1
--- Child, value = 2
-- Parent, Child value sum = 7 (3+4)
--- Child, value = 3
--- Child, value = 4
(I've attached a project and data as a proper example.)
I get the right numbers in parent by using {Sum(Child, childData.value)}. But if I put the same formula in the grandparent databand I do not get the expected result, I get the result one of the parents had at some time.
How do I get the grandparent databand to summarize correctly the values from it's grandchildren?
- Grandparent
-- Parent (master is Grandparent, nested databand)
--- Child (master is Parent, nested databands nested databand)
The data is also related in a similar way, parent has a id relationship to grandparent, and child has a id relationship to parent.
In the Child data there is values I want to summarize, first in the parent, then in the grandparent.
An example
- Grandparent, Grandchild sum = 10 (1+2+3+4)
-- Parent, Child value sum = 3 (1+2)
--- Child, value = 1
--- Child, value = 2
-- Parent, Child value sum = 7 (3+4)
--- Child, value = 3
--- Child, value = 4
(I've attached a project and data as a proper example.)
I get the right numbers in parent by using {Sum(Child, childData.value)}. But if I put the same formula in the grandparent databand I do not get the expected result, I get the result one of the parents had at some time.
How do I get the grandparent databand to summarize correctly the values from it's grandchildren?
- Attachments
-
- StimulsoftTest.zip
- (4.1 KiB) Downloaded 297 times
Re: Summarizing data from a nested databands nested databand
Hello, George!
You can calculate totals by data source also. For example, you can use child data source in this case. Try to use:
Let me know if you need any help.
Thank you.
You can calculate totals by data source also. For example, you can use child data source in this case. Try to use:
Code: Select all
{Totals.Sum(child, child.childValueToSum)}
Thank you.
-
- Posts: 7
- Joined: Wed Feb 10, 2016 12:48 pm
Re: Summarizing data from a nested databands nested databand
Hi Jan!
Thank you for your response, it works great if there is only one grandparent.
My usecase requires that I support multiple grandparents, as in here;
- Grandparent, Grandchild sum = 10 (1+2+3+4)
-- Parent, Child value sum = 3 (1+2)
--- Child, value = 1
--- Child, value = 2
-- Parent, Child value sum = 7 (3+4)
--- Child, value = 3
--- Child, value = 4
- Grandparent, Grandchild sum = 26 (5+6+7+8)
-- Parent, Child value sum = 11 (5+6)
--- Child, value = 5
--- Child, value = 6
-- Parent, Child value sum = 15 (7+8)
--- Child, value = 7
--- Child, value = 8
Any suggestions are appreciated.
Thank you for your response, it works great if there is only one grandparent.
My usecase requires that I support multiple grandparents, as in here;
- Grandparent, Grandchild sum = 10 (1+2+3+4)
-- Parent, Child value sum = 3 (1+2)
--- Child, value = 1
--- Child, value = 2
-- Parent, Child value sum = 7 (3+4)
--- Child, value = 3
--- Child, value = 4
- Grandparent, Grandchild sum = 26 (5+6+7+8)
-- Parent, Child value sum = 11 (5+6)
--- Child, value = 5
--- Child, value = 6
-- Parent, Child value sum = 15 (7+8)
--- Child, value = 7
--- Child, value = 8
Any suggestions are appreciated.
Re: Summarizing data from a nested databands nested databand
Hello.
In this case you better to use this expression:
Grandchild Sum: {Sum(DataBand2:DataBand3,child.childValueToSum)}
Thank you.
In this case you better to use this expression:
Grandchild Sum: {Sum(DataBand2:DataBand3,child.childValueToSum)}
Thank you.
-
- Posts: 7
- Joined: Wed Feb 10, 2016 12:48 pm
Re: Summarizing data from a nested databands nested databand
Holy... that worked!
Thank you Aley!
Thank you Aley!
Re: Summarizing data from a nested databands nested databand
Hello.
We are always glad to help you.
Let us know if you need our help.
Thank you.
We are always glad to help you.
Let us know if you need our help.
Thank you.
-
- Posts: 7
- Joined: Wed Feb 10, 2016 12:48 pm
Re: Summarizing data from a nested databands nested databand
Actually, I have a quick follow up;
What if I have another tier, one of great-grandparent that wants to sum the value of the great-grandchildren?
See attached file.
Example Structure (admittedly this is getting a bit silly)
-Great-Grandparent, Great-grandchild sum = 36 ( 1+2+3+4 + 5+6+7+8)
-- Grandparent, Grandchild sum = 10 (1+2+3+4)
--- Parent, Child value sum = 3 (1+2)
---- Child, value = 1
---- Child, value = 2
--- Parent, Child value sum = 7 (3+4)
---- Child, value = 3
---- Child, value = 4
-- Grandparent, Grandchild sum = 26 (5+6+7+8)
--- Parent, Child value sum = 11 (5+6)
---- Child, value = 5
---- Child, value = 6
--- Parent, Child value sum = 15 (7+8)
---- Child, value = 7
---- Child, value = 8
-Great-Grandparent, Great-grandchild sum = 100 (9+10+11+12+13+14+15+16)
-- Grandparent, Grandchild sum = 10 (9+10+11+12)
--- Parent, Child value sum = 19 (9+10)
---- Child, value = 9
---- Child, value = 10
--- Parent, Child value sum = 23 (11+12)
---- Child, value = 11
---- Child, value = 12
-- Grandparent, Grandchild sum = 58 (13+14+15+16)
--- Parent, Child value sum = 27 (13+14)
---- Child, value = 13
---- Child, value = 14
--- Parent, Child value sum = 31 (15+16)
---- Child, value = 15
---- Child, value = 16
What if I have another tier, one of great-grandparent that wants to sum the value of the great-grandchildren?
See attached file.
Example Structure (admittedly this is getting a bit silly)
-Great-Grandparent, Great-grandchild sum = 36 ( 1+2+3+4 + 5+6+7+8)
-- Grandparent, Grandchild sum = 10 (1+2+3+4)
--- Parent, Child value sum = 3 (1+2)
---- Child, value = 1
---- Child, value = 2
--- Parent, Child value sum = 7 (3+4)
---- Child, value = 3
---- Child, value = 4
-- Grandparent, Grandchild sum = 26 (5+6+7+8)
--- Parent, Child value sum = 11 (5+6)
---- Child, value = 5
---- Child, value = 6
--- Parent, Child value sum = 15 (7+8)
---- Child, value = 7
---- Child, value = 8
-Great-Grandparent, Great-grandchild sum = 100 (9+10+11+12+13+14+15+16)
-- Grandparent, Grandchild sum = 10 (9+10+11+12)
--- Parent, Child value sum = 19 (9+10)
---- Child, value = 9
---- Child, value = 10
--- Parent, Child value sum = 23 (11+12)
---- Child, value = 11
---- Child, value = 12
-- Grandparent, Grandchild sum = 58 (13+14+15+16)
--- Parent, Child value sum = 27 (13+14)
---- Child, value = 13
---- Child, value = 14
--- Parent, Child value sum = 31 (15+16)
---- Child, value = 15
---- Child, value = 16
- Attachments
-
- Report.zip
- (4.43 KiB) Downloaded 338 times
Re: Summarizing data from a nested databands nested databand
Hello,
We found some problem in our code, so we need some additional time for check the issue.
Thank you.
We found some problem in our code, so we need some additional time for check the issue.
Thank you.
Re: Summarizing data from a nested databands nested databand
Hello.
The expression should be next:
But we have found a bug when on some data the sum was calculated wrong.
In your report you see the bug in the Great-grandchild sum.
We have made an improvement of the issue.
The patch will be available in our next prerelease build.
Thank you.
The expression should be next:
Code: Select all
Great-grandchild sum: {Sum(DataBand1:DataBand3,child.childValueToSum)}
In your report you see the bug in the Great-grandchild sum.
We have made an improvement of the issue.
The patch will be available in our next prerelease build.
Thank you.