2 Comments

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":

 

image

 

Follow the steps below, to create this report:

 

Table design

image

 

Table contents

image

 

Add new report

Start Microsoft SQL Server 2008 R2 Report Builder 3.0 > New Report > Blank Report

image

 

Add a new data source to the report

Add a data source [Right click Data Sources > Add Data Source…]

image

 

The [Add Data Source Wizard]:

image

 

Add a new dataset to the report

Add a dataset [Right click Datasets > Add Dataset…]

image

 

The [Add Dataset Wizard]:

image

 

Add a tablix to the report

Add a tablix [Click in the ribbon on Insert > Table > Table Wizard…]

image

 

The [Add Table Wizard]

image

Add Parent and Child to Row groups and Cost to Values

image

Choose [Stepped subtotals above]

image

 

image

 

Row visibility

Right click on the row header of the [Child] row > Row Visibility…

image

Show or hide based on an expression: = IIF(Fields!Parent.Value = "John", False, True)

image

 

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…

image

image

 

InitialToggleState

Select row header of the [Parent] row > Properties > InitialToggleState > <Expression…>

=IIf(Fields!Parent.Value = "John", True, False)

image

 

image

 

Run the report

image

2 Replies to “How to collapse / expand a specific row group in a tablix in Microsoft Reporting Services 2008 / Report Builder 3.0”

  1. 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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts