Hi I need help with setup in SSRS to properly display children in multiple parents in Hierarchy report.
This is what I have done.
select * from PCA
This is PCA table
Parent Child
ASSY1 CHILD1
ASSY1 CHILD2
CHILD1 ACHILD1
CHILD1 ACHILLD2
ACHILD1 BCHILD1
ACHILD1 BCHILD2
This is the CTE in report dataset
WITH tBOM AS(
SELECT Parent,Child, 0 as BOMLevel from PCA A
WHERE Parent='ASSY1'
UNION ALL
SELECT C.Parent, C.Child, BOMLevel+1 from PCA C
INNER JOIN tBOM on tBOM.Child=C.Parent
)
SELECT row_number() over (Order by Parent), * FROM tBOM
This is the setup in SSRS rdl file. And the report when I run it. Group by Child, and I set the recursive parent as parent. I Also set the Group visibility so i get the plus sign to do drill down and also padding. all looks good.
Padding left is set like so:
=20 * Level() & "pt"
UNTIL: I add one more row to the table.
Parent Child
ASSY1 CHILD1
ASSY1 CHILD2
CHILD1 ACHILD1
CHILD1 ACHILLD2
ACHILD1 BCHILD1
ACHILD1 BCHILD2
**ACHILLD2 BCHILD2**
I expect something below ACHILLD2
But no: this is what I get
MORE to this. if I add more rows to increase the depth , the result will be more incorrect. For example if I add a children to BCHILD2,
Best Solution
After reading hours of article. I come to the conclusion that SSRS is not able to achive my end goal. sad I know. but it is what it is
https://connect.microsoft.com/SQLServer/feedback/details/724449/bug-found-when-using-the-ssrs-recursive-hierarchy-feature-with-multi-parent-relationships
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/a65bf4a4-e3b6-4c33-aa9e-6f7d7e4b7f5e/bill-of-materials-recursive-parent-report?forum=sqlreportingservices