Let’s say you want to show costs on a parent child hierarchy in a Microsoft SQL Server Reporting Service 2008 R2 report and you want only to expand the children of parent "John":
Follow the steps below, to create this report:
Table design
Table contents
Add new report
Start Microsoft SQL Server 2008 R2 Report Builder 3.0 > New Report > Blank Report
Add a new data source to the report
Add a data source [Right click Data Sources > Add Data Source…]
The [Add Data Source Wizard]:
Add a new dataset to the report
Add a dataset [Right click Datasets > Add Dataset…]
The [Add Dataset Wizard]:
Add a tablix to the report
Add a tablix [Click in the ribbon on Insert > Table > Table Wizard…]
The [Add Table Wizard]
Add Parent and Child to Row groups and Cost to Values
Choose [Stepped subtotals above]
Row visibility
Right click on the row header of the [Child] row > Row Visibility…
Show or hide based on an expression: = IIF(Fields!Parent.Value = "John", False, True)
Group visibility
Make sure this expression is forwarded to the group visibility > right click on the row header of the [Child] row > Row Group > Group Properties…
InitialToggleState
Select row header of the [Parent] row > Properties > InitialToggleState > <Expression…>
=IIf(Fields!Parent.Value = "John", True, False)
Hoi Roel,
Mag ik jou een vraag stellen betreffende grouping in een RDLC report? Wat je hierboven doet is precies wat ik zoek, alleen ik heb een Parent waar veel meer columns in zitten. Mijn rapport moet er ongeveer zo uit gaan zien:
Ik heb een column Hoofdstuk en is opgebouwd uit xx.xx.xx waarbij de x een nummer is, dus b.v. 51.00.00, string
Een column Omschrijving, string
Een column Aantal, numeriek
Een column Norm,numeriek
en nog een aantal columns.
Wat ik wil bereiken is het volgende:
Trouwens de columns Par en Nr heb ik zelf toegevoegd en bevatten een expression. Par b.v. Mid(Fields!Hoofdstuk.Value,4,2)
Hoofdstuk Par Nr Omschrijving Aantal Norm Totaal
51 00 00 Heiwerk 0 0
01 00 Heipaal A 4 3 12
02 00 Heipaal B 5 4 20 Subtotaal 32
53 00 00 Houten Wanden 0 0
01 00 3 m x 4 m 5 2 10
02 00 4m x 4 m 7 2 14
Subtotaal 24
Mijn grouping op de Parent zijn de eerste twee nummers van het Hoofdstuk:
Left(Fields!Hoofdstuk.Value,2)
Als mijn report expanded is moet hij er uitzien als bovenstaande. Dit lukt me wel. Het probleem wat ik heb is als ik mijn report collapse.
Dan verdwijnt alles en zie ik alleen de subtotalen, maar wat ik wil is dat de Childs verdwijnen en de Parent en subtotalen zichtbaar blijven. Bij mij gebeurd er dus dit:
Hoofdstuk Par Nr Omschrijving Aantal Norm Totaal
Subtotaal 32
Subtotaal 24
Maar het moet dit worden:
Hoofdstuk Par Nr Omschrijving Aantal Norm Totaal
51 00 00 Heiwerk 0 0
Subtotaal 32
53 00 00 Houten Wanden 0 0
Subtotaal 24
Ik hoop dat ik het een beetje redelijk heb uitgelegd en dat je hier een antwoord op weet. Alvast hartelijk dank voor een reactie.
Mark
Hmm, ik zie dat mijn opmaak is verdwenen.