0
votes

I am facing a series issue in creating a report that shows parent/child content and showing the summary and I am having a problem in doing that. We are working on some sort of an accounting report called "income statement" in which certain types of accounts are grouped together and being putted under a group. Within the report, I have to show the group name at the top then listing the the account name/account value pair associated with the group beneath it and of course at the end of each group there will be a summary. The problem comes from this side, I may have a group that consists of both accounts and other groups that contains other accounts which will result in a form of tree, for example, root -> group 1 -> (account 1, account 2, group 2 - > (account 3, account 4)), here I am having a root group containing a group called group 1 which including 2 accounts, account 1 and account 2, and another group called group 2 which contains 2 accounts, account 3, and account 4. According to the above explanation I do not know in advance the depth of the group levels and as a result I do not know how many groups to create with the crystal report at design time because such group creation needs to be dynamic. I searched and googled and I found a solution called hierarchical grouping made through crystal report and it works 100% fine in creating parent/child hierarchy with any hierarchical depth, however, it has a problem it does not include the child group within the parent group, however, it consider and handle each group as a separate group. For example, it will create the above within the report as

group header (root group)
group footer (root group) (root group summary) 3500 USD
group header (group 1)
detail -> (account 1/1000 USD -> account 2/1200 USD)
group footer (group 1) (group 1 summary) 3500 USD
group header (group 2)
detail (account 3/800 USD -> account 4/500 USD)
group footer (group 2) (group 2 summary) 1300 USD

The crystal knows which child is included within which parent and even when calculating summary it takes into account the summary of its childs. What I need is to make the summary of the parents come after its childs' summary like this:

group header (root group)
group header (group 1)
detail (account 1/1000 USD -> account 2 1200/USD)
group header (group 2)
detail (account 3/800 USD -> account 4/500 USD)
group footer (group 2) (group 2 summary) 1300 USD
group footer (group 1) (group 1 summary) 3500 USD
group footer(root group summary) 3500 USD

Bear in mind I do not know the level of groups in advance

1

1 Answers

0
votes

can you post the link where you have seen the hierarichal grouping..

As per the grouping logic of the crystal reports there would be one row in group header and all related records of the that row will come under group 2 and when group 2 completed then if there are any remaining items in group 1 then those will start then again releated records in group and this continues till end of the whole data.

Something like below

Group1: Header

group2: header

details 
details
details

group2:footer

group2: header

details
details

group2: footer

group1: footer

group1: header

group2: heaader
details
group2 footer
group1: footer
    .
    .
    .
    .

This is how crystal rerpots where you get parent child relationship