Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to add functionality to a legacy (not-written-by-me-or-anyone-within-emailshot) SSRS report so that it will, when exported to Excel, generate each section/page break on a separate sheet.

There were already several RowGrouping values in the (three, to be precise); I added one. The one I added is "matrix1_RowGroup5"

Here is what I think are the pertinent parts of the "RowGroupings" section of the report:

XML
<RowGroupings>
  <RowGrouping>
      <Grouping Name="matrix1_RowGroup2">
        <GroupExpressions>
          <GroupExpression>=Fields!Unit.Value</GroupExpression>
        </GroupExpressions>
      </Grouping>
      <Sorting>
        <SortBy>
          <SortExpression>=Fields!Description.Value</SortExpression>
          <Direction>Ascending</Direction>
        </SortBy>
      </Sorting>
  </RowGrouping>

  <RowGrouping>
      <Grouping Name="matrix1_RowGroup4">
        <GroupExpressions>
          <GroupExpression>=Fields!ItemCode.Value</GroupExpression>
        </GroupExpressions>
      </Grouping>
      <Sorting>
        <SortBy>
          <SortExpression>=Fields!Description.Value</SortExpression>
          <Direction>Ascending</Direction>
        </SortBy>
      </Sorting>
  </RowGrouping>

  <RowGrouping>
      <Grouping Name="matrix1_RowGroup1">
        <GroupExpressions>
          <GroupExpression>=Fields!ShortName.Value</GroupExpression>
        </GroupExpressions>
      </Grouping>
      <Sorting>
        <SortBy>
          <SortExpression>=Fields!regionorder.Value</SortExpression>
          <Direction>Ascending</Direction>
        </SortBy>
      </Sorting>
  </RowGrouping>

  <RowGrouping>
      <Grouping Name="matrix1_RowGroup5">
        <GroupExpressions>
          <GroupExpression>=Fields!ShortName.Value</GroupExpression>
        </GroupExpressions>
        <PageBreakAtEnd>false</PageBreakAtEnd>
      </Grouping>
    <FixedHeader>true</FixedHeader>
  </RowGrouping>
</RowGroupings>


The one I added, the last one shown above ("matrix1_RowGroup5") - which I added by using the context menu to the left of the data row on the Layout pane - differs from the others in that it has a "PageBreakAtEnd" element, a "FixedHeader" element, and does *not* have a "Sorting" element. When I have "PageBreakAtEnd" set to true, I get 667 pages, but with only one row of data on each page; when I have "PageBreakAtEnd" set to false, it puts everything on one page (even though there are hundreds of rows).

What do I need to tweak (change, add, or remove) to get the report to create page breaks when a specific field value (unique values of "Unit" in my case) has reached the end of its data?

What I need is for all the "ShortName" values to be together, sorted by Description. When "ShortName" changes, there should be a page break/new sheet. You can think of "ShortName" as a band name (Rolling Stones, CCR, Ozark Mountain Daredevils, The Zombies, etc.) and "Description" as song title, such as "Jumpin' Jack Flash", "Proud Mary", "Jackie Blue", and "Time of the Season" (but there would be many
Descriptions/SongTitles for each ShortName/band name).

If anyone thinks that is necessary to have/see, here is the "RowGroupings" section in its entirety:

XML
<RowGroupings>
  <RowGrouping>
    <Width>2in</Width>
    <DynamicRows>
      <Grouping Name="matrix1_RowGroup2">
        <GroupExpressions>
          <GroupExpression>=Fields!Unit.Value</GroupExpression>
        </GroupExpressions>
      </Grouping>
      <Sorting>
        <SortBy>
          <SortExpression>=Fields!Description.Value</SortExpression>
          <Direction>Ascending</Direction>
        </SortBy>
      </Sorting>
      <ReportItems>
        <Textbox Name="textboxDescriptionData">
          <Style>
            <BorderStyle>
              <Left>None</Left>
              <Right>None</Right>
              <Top>None</Top>
              <Bottom>None</Bottom>
            </BorderStyle>
            <FontSize>7pt</FontSize>
            <FontWeight>200</FontWeight>
            <TextAlign>Left</TextAlign>
            <PaddingLeft>2pt</PaddingLeft>
            <PaddingRight>2pt</PaddingRight>
            <PaddingTop>1pt</PaddingTop>
            <PaddingBottom>3pt</PaddingBottom>
          </Style>
          <ZIndex>4</ZIndex>
          <Value>=Fields!Description.Value</Value>
        </Textbox>
      </ReportItems>
    </DynamicRows>
  </RowGrouping>
  <RowGrouping>
    <Width>0.5in</Width>
    <DynamicRows>
      <Grouping Name="matrix1_RowGroup4">
        <GroupExpressions>
          <GroupExpression>=Fields!ItemCode.Value</GroupExpression>
        </GroupExpressions>
      </Grouping>
      <Sorting>
        <SortBy>
          <SortExpression>=Fields!Description.Value</SortExpression>
          <Direction>Ascending</Direction>
        </SortBy>
      </Sorting>
      <ReportItems>
        <Textbox Name="textboxItemCodeData">
          <Style>
            <BorderStyle>
              <Left>None</Left>
              <Right>None</Right>
              <Top>None</Top>
              <Bottom>None</Bottom>
            </BorderStyle>
            <FontSize>7pt</FontSize>
            <FontWeight>200</FontWeight>
            <TextAlign>Left</TextAlign>
            <PaddingLeft>2pt</PaddingLeft>
            <PaddingRight>2pt</PaddingRight>
            <PaddingTop>1pt</PaddingTop>
            <PaddingBottom>3pt</PaddingBottom>
          </Style>
          <ZIndex>3</ZIndex>
          <CanGrow>true</CanGrow>
          <Value>=Fields!ItemCode.Value</Value>
        </Textbox>
      </ReportItems>
    </DynamicRows>
  </RowGrouping>
  <RowGrouping>
    <Width>1in</Width>
    <DynamicRows>
      <Grouping Name="matrix1_RowGroup1">
        <GroupExpressions>
          <GroupExpression>=Fields!ShortName.Value</GroupExpression>
        </GroupExpressions>
      </Grouping>
      <Sorting>
        <SortBy>
          <SortExpression>=Fields!regionorder.Value</SortExpression>
          <Direction>Ascending</Direction>
        </SortBy>
      </Sorting>
      <ReportItems>
        <Textbox Name="textboxMemberData">
          <Style>
            <BorderStyle>
              <Left>None</Left>
              <Right>None</Right>
              <Top>None</Top>
              <Bottom>None</Bottom>
            </BorderStyle>
            <FontSize>7pt</FontSize>
            <FontWeight>200</FontWeight>
            <TextAlign>Left</TextAlign>
            <PaddingLeft>2pt</PaddingLeft>
            <PaddingRight>2pt</PaddingRight>
            <PaddingTop>1pt</PaddingTop>
            <PaddingBottom>3pt</PaddingBottom>
          </Style>
          <ZIndex>2</ZIndex>
          <CanGrow>true</CanGrow>
          <Value>=Fields!ShortName.Value</Value>
        </Textbox>
      </ReportItems>
    </DynamicRows>
  </RowGrouping>
  <RowGrouping>
    <Width>1in</Width>
    <DynamicRows>
      <Grouping Name="matrix1_RowGroup5">
        <GroupExpressions>
          <GroupExpression>=Fields!ShortName.Value</GroupExpression>
        </GroupExpressions>
        <PageBreakAtEnd>false</PageBreakAtEnd>
      </Grouping>
      <ReportItems>
        <Textbox Name="textbox1">
          <rd:DefaultName>textbox1</rd:DefaultName>
          <Style>
            <BorderStyle>
              <Left>None</Left>
              <Right>None</Right>
              <Top>None</Top>
              <Bottom>None</Bottom>
            </BorderStyle>
            <FontSize>7pt</FontSize>
            <FontWeight>200</FontWeight>
            <TextAlign>Left</TextAlign>
            <PaddingLeft>2pt</PaddingLeft>
            <PaddingRight>2pt</PaddingRight>
            <PaddingTop>1pt</PaddingTop>
            <PaddingBottom>3pt</PaddingBottom>
          </Style>
          <ZIndex>1</ZIndex>
          <CanGrow>true</CanGrow>
          <Value>=Fields!Unit.Value</Value>
        </Textbox>
      </ReportItems>
    </DynamicRows>
    <FixedHeader>true</FixedHeader>
  </RowGrouping>
</RowGroupings>


What I have tried:

I tried adding a new RowGrouping, but I only get one of two extremes with it so far: either 1 page or hundreds; there should be dozens.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900