DynamicGroup.rdl

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="https://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition" xmlns:rd="https://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <RightMargin>1in</RightMargin>
  <Body>
    <ReportItems>
      <Table Name="table1">
        <Height>1.25in</Height>
        <Style />
        <Header>
          <TableRows>
            <TableRow>
              <Height>0.25in</Height>
              <TableCells>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox2">
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <TextAlign>Left</TextAlign>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingRight>2pt</PaddingRight>
                        <FontWeight>700</FontWeight>
                      </Style>
                      <ZIndex>19</ZIndex>
                      <rd:DefaultName>textbox2</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value>=Parameters!Group1.Value</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox4">
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <TextAlign>Left</TextAlign>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingRight>2pt</PaddingRight>
                        <FontWeight>700</FontWeight>
                      </Style>
                      <ZIndex>18</ZIndex>
                      <CanGrow>true</CanGrow>
                      <Value>=Parameters!Group2.Value</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox1">
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <TextAlign>Left</TextAlign>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingRight>2pt</PaddingRight>
                        <FontWeight>700</FontWeight>
                      </Style>
                      <ZIndex>17</ZIndex>
                      <rd:DefaultName>textbox1</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value>=Parameters!Group3.Value</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox29">
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <TextAlign>Right</TextAlign>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingRight>2pt</PaddingRight>
                        <FontWeight>700</FontWeight>
                      </Style>
                      <ZIndex>16</ZIndex>
                      <rd:DefaultName>textbox29</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value>Quantity</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
              </TableCells>
            </TableRow>
          </TableRows>
          <RepeatOnNewPage>true</RepeatOnNewPage>
        </Header>
        <DataSetName>DataSet1</DataSetName>
        <Width>5.25in</Width>
        <TableGroups>
          <TableGroup>
            <Header>
              <TableRows>
                <TableRow>
                  <Height>0.25in</Height>
                  <TableCells>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox10">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>15</ZIndex>
                          <rd:DefaultName>textbox10</rd:DefaultName>
                          <CanGrow>true</CanGrow>
                          <Value>=Fields(iif(Parameters!Group1.Value is Nothing, "Year", Parameters!Group1.Value)).Value</Value>
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox11">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <TextAlign>Left</TextAlign>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>14</ZIndex>
                          <rd:DefaultName>textbox11</rd:DefaultName>
                          <CanGrow>true</CanGrow>
                          <Value />
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox5">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <TextAlign>Left</TextAlign>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>13</ZIndex>
                          <rd:DefaultName>textbox5</rd:DefaultName>
                          <CanGrow>true</CanGrow>
                          <Value />
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="Quantity_2">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <TextAlign>Right</TextAlign>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>12</ZIndex>
                          <rd:DefaultName>Quantity_2</rd:DefaultName>
                          <CanGrow>true</CanGrow>
                          <Value>=Sum(Fields!Quantity.Value)</Value>
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                  </TableCells>
                  <Visibility>
                    <Hidden>=Parameters!Group1.Value is Nothing</Hidden>
                  </Visibility>
                </TableRow>
              </TableRows>
            </Header>
            <Grouping Name="table1_Group1">
              <GroupExpressions>
                <GroupExpression>=iif(Parameters!Group1.Value is Nothing,1,Fields(iif(Parameters!Group1.Value is Nothing, "Year",Parameters!Group1.Value)).Value)</GroupExpression>
              </GroupExpressions>
            </Grouping>
          </TableGroup>
          <TableGroup>
            <Header>
              <TableRows>
                <TableRow>
                  <Height>0.25in</Height>
                  <TableCells>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox16">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <TextAlign>Left</TextAlign>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>11</ZIndex>
                          <rd:DefaultName>textbox16</rd:DefaultName>
                          <CanGrow>true</CanGrow>
                          <Value />
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox3">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <TextAlign>Left</TextAlign>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>10</ZIndex>
                          <CanGrow>true</CanGrow>
                          <Value>=Fields(iif(Parameters!Group2.Value is Nothing, "Year", Parameters!Group2.Value)).Value</Value>
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox9">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>9</ZIndex>
                          <rd:DefaultName>textbox9</rd:DefaultName>
                          <CanGrow>true</CanGrow>
                          <Value />
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="Quantity_3">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <TextAlign>Right</TextAlign>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>8</ZIndex>
                          <rd:DefaultName>Quantity_3</rd:DefaultName>
                          <CanGrow>true</CanGrow>
                          <Value>=Sum(Fields!Quantity.Value)</Value>
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                  </TableCells>
                  <Visibility>
                    <Hidden>=Parameters!Group2.Value is Nothing</Hidden>
                  </Visibility>
                </TableRow>
              </TableRows>
            </Header>
            <Grouping Name="table1_Group2">
              <GroupExpressions>
                <GroupExpression>=iif(Parameters!Group2.Value is Nothing,1,Fields(iif(Parameters!Group2.Value is Nothing, "Year",Parameters!Group2.Value)).Value)</GroupExpression>
              </GroupExpressions>
            </Grouping>
          </TableGroup>
          <TableGroup>
            <Header>
              <TableRows>
                <TableRow>
                  <Height>0.25in</Height>
                  <TableCells>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox6">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <TextAlign>Left</TextAlign>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>7</ZIndex>
                          <rd:DefaultName>textbox6</rd:DefaultName>
                          <CanGrow>true</CanGrow>
                          <Value />
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox8">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <TextAlign>Left</TextAlign>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>6</ZIndex>
                          <rd:DefaultName>textbox8</rd:DefaultName>
                          <CanGrow>true</CanGrow>
                          <Value />
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="textbox7">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <TextAlign>Left</TextAlign>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>5</ZIndex>
                          <CanGrow>true</CanGrow>
                          <Value>=Fields(iif(Parameters!Group3.Value is Nothing, "Year", Parameters!Group3.Value)).Value</Value>
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                    <TableCell>
                      <ReportItems>
                        <Textbox Name="Quantity_4">
                          <Style>
                            <PaddingLeft>2pt</PaddingLeft>
                            <TextAlign>Right</TextAlign>
                            <PaddingBottom>2pt</PaddingBottom>
                            <PaddingTop>2pt</PaddingTop>
                            <PaddingRight>2pt</PaddingRight>
                          </Style>
                          <ZIndex>4</ZIndex>
                          <rd:DefaultName>Quantity_4</rd:DefaultName>
                          <CanGrow>true</CanGrow>
                          <Value>=Sum(Fields!Quantity.Value)</Value>
                        </Textbox>
                      </ReportItems>
                    </TableCell>
                  </TableCells>
                  <Visibility>
                    <Hidden>=Parameters!Group3.Value is Nothing</Hidden>
                  </Visibility>
                </TableRow>
              </TableRows>
            </Header>
            <Grouping Name="table1_Group3">
              <GroupExpressions>
                <GroupExpression>=iif(Parameters!Group3.Value is Nothing,1,Fields(iif(Parameters!Group3.Value is Nothing, "Year",Parameters!Group3.Value)).Value)</GroupExpression>
              </GroupExpressions>
            </Grouping>
          </TableGroup>
        </TableGroups>
        <Footer>
          <TableRows>
            <TableRow>
              <Height>0.25in</Height>
              <TableCells>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox12">
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingRight>2pt</PaddingRight>
                        <FontWeight>700</FontWeight>
                      </Style>
                      <ZIndex>3</ZIndex>
                      <rd:DefaultName>textbox12</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value>Total</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox13">
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingRight>2pt</PaddingRight>
                        <FontWeight>700</FontWeight>
                      </Style>
                      <ZIndex>2</ZIndex>
                      <rd:DefaultName>textbox13</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value />
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox14">
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingRight>2pt</PaddingRight>
                        <FontWeight>700</FontWeight>
                      </Style>
                      <ZIndex>1</ZIndex>
                      <rd:DefaultName>textbox14</rd:DefaultName>
                      <CanGrow>true</CanGrow>
                      <Value />
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox17">
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <TextAlign>Right</TextAlign>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingTop>2pt</PaddingTop>
                        <PaddingRight>2pt</PaddingRight>
                        <FontWeight>700</FontWeight>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value>=Sum(Fields!Quantity.Value)</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
              </TableCells>
            </TableRow>
          </TableRows>
        </Footer>
        <TableColumns>
          <TableColumn>
            <Width>1.5in</Width>
            <Visibility>
              <Hidden>=Parameters!Group1.Value is Nothing</Hidden>
            </Visibility>
          </TableColumn>
          <TableColumn>
            <Width>1.5in</Width>
            <Visibility>
              <Hidden>=Parameters!Group2.Value is Nothing</Hidden>
            </Visibility>
          </TableColumn>
          <TableColumn>
            <Width>1.5in</Width>
            <Visibility>
              <Hidden>=Parameters!Group3.Value is Nothing</Hidden>
            </Visibility>
          </TableColumn>
          <TableColumn>
            <Width>0.75in</Width>
          </TableColumn>
        </TableColumns>
      </Table>
    </ReportItems>
    <Style />
    <Height>1.375in</Height>
  </Body>
  <TopMargin>1in</TopMargin>
  <DataSources>
    <DataSource Name="AdventureWorks2000">
      <rd:DataSourceID>5db4126a-bb58-4b0a-b47b-5d13aa506c1d</rd:DataSourceID>
      <ConnectionProperties>
        <DataProvider>SQL</DataProvider>
        <ConnectString>data source=.;initial catalog=AdventureWorks2000</ConnectString>
        <IntegratedSecurity>true</IntegratedSecurity>
      </ConnectionProperties>
    </DataSource>
  </DataSources>
  <Width>5.375in</Width>
  <DataSets>
    <DataSet Name="DataSet1">
      <Fields>
        <Field Name="Product">
          <DataField>Product</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="SubCategory">
          <DataField>SubCategory</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="Category">
          <DataField>Category</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="Quantity">
          <DataField>Quantity</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Year">
          <DataField>Year</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="Territory">
          <DataField>Territory</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
      <Query>
        <DataSourceName>AdventureWorks2000</DataSourceName>
        <CommandText>SELECT     Product.Name AS Product, ProductSubCategory.Name AS SubCategory, ProductCategory.Name AS Category, SUM(SalesOrderDetail.OrderQty)
                      AS Quantity, DATEPART(yyyy, SalesOrderHeader.OrderDate) AS Year, SalesTerritory.Name AS Territory
FROM         Product INNER JOIN
                      ProductSubCategory ON Product.ProductSubCategoryID = ProductSubCategory.ProductSubCategoryID INNER JOIN
                      ProductCategory ON ProductSubCategory.ProductCategoryID = ProductCategory.ProductCategoryID INNER JOIN
                      SalesOrderDetail ON Product.ProductID = SalesOrderDetail.ProductID INNER JOIN
                      SalesOrderHeader ON SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID INNER JOIN
                      SalesTerritory ON SalesOrderHeader.TerritoryID = SalesTerritory.TerritoryID
GROUP BY Product.Name, ProductSubCategory.Name, ProductCategory.Name, SalesOrderHeader.OrderDate, SalesTerritory.Name</CommandText>
      </Query>
    </DataSet>
  </DataSets>
  <LeftMargin>1in</LeftMargin>
  <rd:SnapToGrid>true</rd:SnapToGrid>
  <rd:DrawGrid>true</rd:DrawGrid>
  <Description />
  <rd:ReportID>5f07b29a-5f39-47c0-92ae-56c8ab0b31cc</rd:ReportID>
  <BottomMargin>1in</BottomMargin>
  <ReportParameters>
    <ReportParameter Name="Group1">
      <DataType>String</DataType>
      <Nullable>true</Nullable>
      <DefaultValue>
        <Values>
          <Value>Category</Value>
        </Values>
      </DefaultValue>
      <Prompt>Group 1</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>Category</Value>
          </ParameterValue>
          <ParameterValue>
            <Value>Year</Value>
          </ParameterValue>
          <ParameterValue>
            <Value>Territory</Value>
          </ParameterValue>
          <ParameterValue>
            <Label>None</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="Group2">
      <DataType>String</DataType>
      <Nullable>true</Nullable>
      <DefaultValue>
        <Values>
          <Value>Year</Value>
        </Values>
      </DefaultValue>
      <Prompt>Group 2</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>Category</Value>
          </ParameterValue>
          <ParameterValue>
            <Value>Year</Value>
          </ParameterValue>
          <ParameterValue>
            <Value>Territory</Value>
          </ParameterValue>
          <ParameterValue>
            <Label>None</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
    <ReportParameter Name="Group3">
      <DataType>String</DataType>
      <Nullable>true</Nullable>
      <DefaultValue>
        <Values>
          <Value>Territory</Value>
        </Values>
      </DefaultValue>
      <Prompt>Group 3</Prompt>
      <ValidValues>
        <ParameterValues>
          <ParameterValue>
            <Value>Category</Value>
          </ParameterValue>
          <ParameterValue>
            <Value>Year</Value>
          </ParameterValue>
          <ParameterValue>
            <Value>Territory</Value>
          </ParameterValue>
          <ParameterValue>
            <Label>None</Label>
          </ParameterValue>
        </ParameterValues>
      </ValidValues>
    </ReportParameter>
  </ReportParameters>
</Report>