Share via


3.2 Report in RDL schema 2010/01

The following is an example of the RDL for a report in Schema version RDL 2010/01. It shows the usage of the various properties of a Report element. The example uses elements for describing the data: DataSources and DataSets; elements for describing the structure and layout for two ReportSection elements: Page, including Page.PageHeader and Page.PageFooter, and Body; and elements for describing the ReportParameters and Variables for the report.

The following figure shows an example rendering of this report.

RDL schema 2010/01 report rendering

Figure 10: RDL schema 2010/01 report rendering

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <Report 
 xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">
 3  <AutoRefresh>3600</AutoRefresh>
 4  <DataSources>
 5    <DataSource Name="DataSource1">
 6      <ConnectionProperties>
 7        <DataProvider>SQL</DataProvider>
 8        <ConnectString>data source=DataServer; initial 
             catalog=northwind;</ConnectString>
 9      </ConnectionProperties>
 10    </DataSource>
 11  </DataSources>
 12  <DataSets>
 13    <DataSet Name="DataSet1">
 14      <Fields>
 15        <Field Name="ProductID">
 16          <DataField>ProductID</DataField>
 17        </Field>
 18        <Field Name="ProductName">
 19          <DataField>ProductName</DataField>
 20        </Field>
 21        <Field Name="SupplierID">
 22          <DataField>SupplierID</DataField>
 23        </Field>
 24        <Field Name="CategoryID">
 25          <DataField>CategoryID</DataField>
 26        </Field>
 27        <Field Name="QuantityPerUnit">
 28          <DataField>QuantityPerUnit</DataField>
 29        </Field>
 30        <Field Name="UnitPrice">
 31          <DataField>UnitPrice</DataField>
 32        </Field>
 33        <Field Name="UnitsInStock">
 34          <DataField>UnitsInStock</DataField>
 35        </Field>
 36        <Field Name="UnitsOnOrder">
 37          <DataField>UnitsOnOrder</DataField>
 38        </Field>
 39        <Field Name="ReorderLevel">
 40          <DataField>ReorderLevel</DataField>
 41        </Field>
 42        <Field Name="Discontinued">
 43          <DataField>Discontinued</DataField>
 44        </Field>
 45      </Fields>
 46      <Query>
 47        <DataSourceName>DataSource1</DataSourceName>
 48        <CommandText>Select * From Products</CommandText>
 49      </Query>
 50    </DataSet>
 51  </DataSets>
 52  <ReportSections>
 53    <ReportSection>
 54      <Body>
 55        <ReportItems>
 56          <Textbox Name="BodyTextbox1">
 57            <CanGrow>true</CanGrow>
 58            <KeepTogether>true</KeepTogether>
 59            <Paragraphs>
 60              <Paragraph>
 61                <TextRuns>
 62                  <TextRun>
 63                    <Value>Body for Report Section 1</Value>
 64                  </TextRun>
 65                </TextRuns>
 66              </Paragraph>
 67            </Paragraphs>
 68            <Top>0.33333in</Top>
 69            <Left>0.3125in</Left>
 70            <Height>1in</Height>
 71            <Width>2.5in</Width>
 72            <Style>
 73              <Border>
 74                <Color>Black</Color>
 75                <Style>Solid</Style>
 76                <Width>1pt</Width>
 77              </Border>
 78              <BackgroundColor>LightSteelBlue</BackgroundColor>
 79            </Style>
 80          </Textbox>
 81        </ReportItems>
 82        <Height>2.5in</Height>
 83        <Style>
 84          <BackgroundColor>LightBlue</BackgroundColor>
 85        </Style>
 86      </Body>
 87      <Width>6.5in</Width>
 88      <Page>
 89        <PageHeader>
 90          <Height>0.5in</Height>
 91          <PrintOnFirstPage>true</PrintOnFirstPage>
 92          <PrintOnLastPage>true</PrintOnLastPage>
 93          <PrintBetweenSections>true</PrintBetweenSections>
 94          <ReportItems>
 95            <Textbox Name="HeaderTextbox1">
 96              <Paragraphs>
 97                <Paragraph>
 98                  <TextRuns>
 99                    <TextRun>
 100                      <Value>Header for Report Section 1</Value>
 101                    </TextRun>
 102                  </TextRuns>
 103                </Paragraph>
 104              </Paragraphs>
 105              <Top>0.14583in</Top>
 106              <Left>0.3125in</Left>
 107              <Height>0.19792in</Height>
 108              <Width>5in</Width>
 109              <Style>
 110                <Border>
 111                  <Color>DarkBlue</Color>
 112                  <Style>Solid</Style>
 113                  <Width>1pt</Width>
 114                </Border>
 115                <BackgroundColor>Gray</BackgroundColor>
 116                <PaddingLeft>2pt</PaddingLeft>
 117                <PaddingRight>2pt</PaddingRight>
 118                <PaddingTop>2pt</PaddingTop>
 119                <PaddingBottom>2pt</PaddingBottom>
 120              </Style>
 121            </Textbox>
 122          </ReportItems>
 123          <Style>
 124            <BackgroundColor>Silver</BackgroundColor>
 125          </Style>
 126        </PageHeader>
 127        <PageFooter>
 128          <Height>0.75in</Height>
 129          <PrintOnFirstPage>true</PrintOnFirstPage>
 130          <PrintOnLastPage>true</PrintOnLastPage>
 131          <PrintBetweenSections>true</PrintBetweenSections>
 132          <ReportItems>
 133            <Textbox Name="FooterTextbox1">
 134              <CanGrow>true</CanGrow>
 135              <KeepTogether>true</KeepTogether>
 136              <Paragraphs>
 137                <Paragraph>
 138                  <TextRuns>
 139                    <TextRun>
 140                      <Value>Footer for Report Section 1</Value>
 141                    </TextRun>
 142                  </TextRuns>
 143                </Paragraph>
 144              </Paragraphs>
 145              <Top>0.25in</Top>
 146              <Left>0.3125in</Left>
 147              <Height>0.17708in</Height>
 148              <Width>5in</Width>
 149              <Style>
 150                <Border>
 151                  <Color>DarkBlue</Color>
 152                  <Style>Solid</Style>
 153                  <Width>1pt</Width>
 154                </Border>
 155                <BackgroundColor>Gray</BackgroundColor>
 156              </Style>
 157            </Textbox>
 158          </ReportItems>
 159          <Style>
 160            <BackgroundColor>LightGrey</BackgroundColor>
 161          </Style>
 162        </PageFooter>
 163        <PageWidth>8.5in</PageWidth>
 164        <PageHeight>5in</PageHeight>
 165        <InteractiveWidth>8.5in</InteractiveWidth>
 166        <LeftMargin>0.5in</LeftMargin>
 167        <RightMargin>0.5in</RightMargin>
 168        <TopMargin>0.25in</TopMargin>
 169        <BottomMargin>0.25in</BottomMargin>
 170        <Style>        
 171          <Border>
 172            <Color>Black</Color>
 173            <Style>Solid</Style>
 174            <Width>1pt</Width>
 175          </Border>
 176        </Style>
 177      </Page>
 178    </ReportSection>
 179    <ReportSection>
 180      <Body>
 181        <ReportItems>
 182          <Textbox Name="BodyTextbox2">
 183            <CanGrow>true</CanGrow>
 184            <KeepTogether>true</KeepTogether>
 185            <Paragraphs>
 186              <Paragraph>
 187                <TextRuns>
 188                  <TextRun>
 189                    <Value>Body for Report Section 2</Value>
 190                  </TextRun>
 191                </TextRuns>
 192              </Paragraph>
 193            </Paragraphs>
 194            <Top>0.33333in</Top>
 195            <Left>0.3125in</Left>
 196            <Height>1in</Height>
 197            <Width>2.5in</Width>
 198            <Style>
 199              <Border>
 200                <Color>Black</Color>
 201                <Style>Solid</Style>
 202                <Width>1pt</Width>
 203              </Border>
 204              <BackgroundColor>Khaki</BackgroundColor>
 205            </Style>
 206          </Textbox>
 207        </ReportItems>
 208        <Height>3in</Height>
 209        <Style>
 210          <BackgroundColor>Tan</BackgroundColor>
 211        </Style>
 212      </Body>
 213      <Width>6.5in</Width>
 214      <Page>
 215        <PageHeader>
 216          <Height>0.5in</Height>
 217          <PrintOnFirstPage>true</PrintOnFirstPage>
 218          <PrintOnLastPage>true</PrintOnLastPage>
 219          <PrintBetweenSections>true</PrintBetweenSections>
 220          <ReportItems>
 221            <Textbox Name="HeaderTextbox2">
 222              <Paragraphs>
 223                <Paragraph>
 224                  <TextRuns>
 225                    <TextRun>
 226                      <Value>Header for Report Section 2</Value>
 227                    </TextRun>
 228                  </TextRuns>
 229                </Paragraph>
 230              </Paragraphs>
 231              <Top>0.14583in</Top>
 232              <Left>0.3125in</Left>
 233              <Height>0.19792in</Height>
 234              <Width>5in</Width>
 235              <Style>
 236                <Border>
 237                  <Color>DarkBlue</Color>
 238                  <Style>Solid</Style>
 239                  <Width>1pt</Width>
 240                </Border>
 241                <BackgroundColor>Gray</BackgroundColor>
 242                <PaddingLeft>2pt</PaddingLeft>
 243                <PaddingRight>2pt</PaddingRight>
 244                <PaddingTop>2pt</PaddingTop>
 245                <PaddingBottom>2pt</PaddingBottom>
 246              </Style>
 247            </Textbox>
 248          </ReportItems>
 249          <Style>
 250            <BackgroundColor>LightSteelBlue</BackgroundColor>
 251          </Style>
 252        </PageHeader>
 253        <PageFooter>
 254          <Height>0.75in</Height>
 255          <PrintOnFirstPage>true</PrintOnFirstPage>
 256          <PrintOnLastPage>true</PrintOnLastPage>
 257          <PrintBetweenSections>true</PrintBetweenSections>
 258          <ReportItems>
 259            <Textbox Name="FooterTextbox2">
 260              <CanGrow>true</CanGrow>
 261              <KeepTogether>true</KeepTogether>
 262              <Paragraphs>
 263                <Paragraph>
 264                  <TextRuns>
 265                    <TextRun>
 266                      <Value>Footer for Report Section 2</Value>
 267                    </TextRun>
 268                  </TextRuns>
 269                </Paragraph>
 270              </Paragraphs>
 271              <Top>0.25in</Top>
 272              <Left>0.3125in</Left>
 273              <Height>0.17708in</Height>
 274              <Width>5in</Width>
 275              <Style>
 276                <Border>
 277                  <Color>DarkBlue</Color>
 278                  <Style>Solid</Style>
 279                  <Width>1pt</Width>
 280                </Border>
 281                <BackgroundColor>Gray</BackgroundColor>
 282              </Style>
 283            </Textbox>
 284          </ReportItems>
 285          <Style>
 286            <BackgroundColor>LightBlue</BackgroundColor>
 287          </Style>
 288        </PageFooter>
 289        <PageWidth>8.5in</PageWidth>
 290        <PageHeight>5in</PageHeight>
 291        <InteractiveWidth>8.5in</InteractiveWidth>
 292        <LeftMargin>0.5in</LeftMargin>
 293        <RightMargin>0.5in</RightMargin>
 294        <TopMargin>0.25in</TopMargin>
 295        <BottomMargin>0.25in</BottomMargin>
 296        <Style>        
 297          <Border>
 298            <Color>Black</Color>
 299            <Style>Solid</Style>
 300            <Width>1pt</Width>
 301          </Border>
 302        </Style>
 303      </Page>
 304    </ReportSection>
 305  </ReportSections>
 306  <Language>=User!Language</Language>
 307  <Variables>
 308    <Variable Name="ReportVariable1">
 309      <Value>=1</Value>
 310    </Variable>
 311  </Variables>
 312  <ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
 313  <ReportParameters>
 314    <ReportParameter Name="Product">
 315      <DataType>String</DataType>
 316      <DefaultValue>
 317        <DataSetReference>
 318          <DataSetName>DataSet1</DataSetName>
 319          <ValueField>ProductID</ValueField>
 320        </DataSetReference>
 321      </DefaultValue>
 322      <Prompt>Product</Prompt>
 323      <ValidValues>
 324        <DataSetReference>
 325          <DataSetName>DataSet1</DataSetName>
 326          <ValueField>ProductID</ValueField>
 327          <LabelField>ProductName</LabelField>
 328        </DataSetReference>
 329      </ValidValues>
 330      <MultiValue>true</MultiValue>
 331    </ReportParameter>
 332    <ReportParameter Name="Quantity">
 333      <DataType>Integer</DataType>
 334      <DefaultValue>
 335        <Values>
 336          <Value DataType="Integer">0</Value>
 337        </Values>
 338      </DefaultValue>
 339      <Prompt>Quantity</Prompt>
 340      <ValidValues>
 341        <ParameterValues>
 342          <ParameterValue>
 343            <Value DataType="Integer">0</Value>
 344            <Label>0</Label>
 345          </ParameterValue>
 346          <ParameterValue>
 347            <Value DataType="Integer">10</Value>
 348            <Label>10</Label>
 349          </ParameterValue>
 350          <ParameterValue>
 351            <Value DataType="Integer">50</Value>
 352            <Label>50</Label>
 353          </ParameterValue>
 354        </ParameterValues>
 355      </ValidValues>
 356    </ReportParameter>
 357  </ReportParameters>
 358</Report>