Centered Images

Question:I have variable sized images I want to display in a table column.  How can I center these images without stretching them to fill the table cell? Answer:While there is no automatic centering behavior for the Image control, you can simulate this by writing an expression for PaddingLeft and PaddingTop to result in a centered…

0

CenteredImage.rdl

<?xml version=”1.0″ encoding=”utf-8″?><Report xmlns=”http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition” xmlns:rd=”http://schemas.microsoft.com/SQLServer/reporting/reportdesigner“>  <CodeModules>    <CodeModule>System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</CodeModule>  </CodeModules>  <RightMargin>1in</RightMargin>  <Body>    <ReportItems>      <Table Name=”table1″>        <Height>3.25in</Height>        <Style />        <Header>          <TableRows>            <TableRow>              <Height>0.25in</Height>              <TableCells>                <TableCell>                  <ReportItems>                    <Textbox Name=”textbox1″>                      <Style>                        <PaddingLeft>2pt</PaddingLeft>                        <BorderStyle>                          <Default>Solid</Default>                        </BorderStyle>                        <PaddingBottom>2pt</PaddingBottom>                        <PaddingTop>2pt</PaddingTop>                        <PaddingRight>2pt</PaddingRight>                      </Style>                      <ZIndex>5</ZIndex>                      <rd:DefaultName>textbox1</rd:DefaultName>                      <CanGrow>true</CanGrow>                      <Value>Product</Value>                    </Textbox>                  </ReportItems>                </TableCell>                <TableCell>                  <ReportItems>                    <Textbox Name=”textbox2″>                      <Style>                        <PaddingLeft>2pt</PaddingLeft>                        <BorderStyle>                          <Default>Solid</Default>                        </BorderStyle>                        <PaddingBottom>2pt</PaddingBottom>                        <PaddingTop>2pt</PaddingTop>                       …

0

Green-Bar Matrix

Question:How can I get a green-bar effect (alternating colors) in a matrix? Answer:For a green-bar table, you can simply use a background color expression like this: =iif(RowNumber(Nothing) Mod 2,”Green”,”White”)However, there is currently no GroupNumber() function on which to base a green-bar calculation in a matrix.GroupNumber can be (mostly) simulated by using the RunningValue function to…

0

MatrixGreenBar.rdl

<?xml version=”1.0″ encoding=”utf-8″?><Report xmlns=”http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition” xmlns:rd=”http://schemas.microsoft.com/SQLServer/reporting/reportdesigner“>  <RightMargin>1in</RightMargin>  <Body>    <ReportItems>      <Matrix Name=”matrix1″>        <Corner>          <ReportItems>            <Textbox Name=”textbox1″>              <Style>                <PaddingLeft>2pt</PaddingLeft>                <BorderStyle>                  <Default>Solid</Default>                </BorderStyle>                <PaddingBottom>2pt</PaddingBottom>                <PaddingTop>2pt</PaddingTop>                <PaddingRight>2pt</PaddingRight>              </Style>              <ZIndex>4</ZIndex>              <rd:DefaultName>textbox1</rd:DefaultName>              <CanGrow>true</CanGrow>              <Value />            </Textbox>          </ReportItems>        </Corner>        <Height>0.5in</Height>        <Style />        <MatrixRows>          <MatrixRow>            <MatrixCells>              <MatrixCell>                <ReportItems>                  <Textbox Name=”Qty”>                    <Style>                      <PaddingLeft>2pt</PaddingLeft>                      <BackgroundColor>=ReportItems!Color.Value</BackgroundColor>                      <BorderStyle>                        <Default>Solid</Default>                      </BorderStyle>                      <TextAlign>Right</TextAlign>                      <PaddingBottom>2pt</PaddingBottom>                      <PaddingTop>2pt</PaddingTop>                      <PaddingRight>2pt</PaddingRight>                    </Style>                    <rd:DefaultName>Qty</rd:DefaultName>                    <CanGrow>true</CanGrow>                    <Value>=Sum(Fields!Qty.Value)</Value>                 …

0

"All" Parameter Value

Question:How can I enable users to select “All” as the value of a query parameter? Answer:The simplest way is to modify your query to accept nulls and map “All” to null. Step 1:  Start with a report that already has a parameterized query and Valid Values queries. Step 2:  Edit your base query to account…

0

SelectAll.rdl

<?xml version=”1.0″ encoding=”utf-8″?><Report xmlns=”http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition” xmlns:rd=”http://schemas.microsoft.com/SQLServer/reporting/reportdesigner“>  <RightMargin>1in</RightMargin>  <Body>    <ReportItems>      <Table Name=”table1″>        <Height>0.5in</Height>        <Style />        <Header>          <TableRows>            <TableRow>              <Height>0.25in</Height>              <TableCells>                <TableCell>                  <ReportItems>                    <Textbox Name=”textbox3″>                      <Style>                        <PaddingLeft>2pt</PaddingLeft>                        <PaddingBottom>2pt</PaddingBottom>                        <PaddingTop>2pt</PaddingTop>                        <PaddingRight>2pt</PaddingRight>                        <FontWeight>700</FontWeight>                      </Style>                      <ZIndex>7</ZIndex>                      <rd:DefaultName>textbox3</rd:DefaultName>                      <CanGrow>true</CanGrow>                      <Value>Category</Value>                    </Textbox>                  </ReportItems>                </TableCell>                <TableCell>                  <ReportItems>                    <Textbox Name=”textbox5″>                      <Style>                        <PaddingLeft>2pt</PaddingLeft>                        <PaddingBottom>2pt</PaddingBottom>                        <PaddingTop>2pt</PaddingTop>                        <PaddingRight>2pt</PaddingRight>                        <FontWeight>700</FontWeight>                      </Style>                      <ZIndex>6</ZIndex>                      <CanGrow>true</CanGrow>                      <Value>Subcategory</Value>                    </Textbox>                  </ReportItems>                </TableCell>                <TableCell>                  <ReportItems>                   …

0

Horizontal Tables

Question:Does Reporting Services support horizontal tables (fixed rows and dynamic columns)? Answer:There is no native “horizontal table” report item, but simple horizontal tables can be simulated using Matrix. Step 1:  Add a matrix to your report Step 2:  Add static rows to the matrixRight-click in the Data cell and select “Add Row”.  Repeat for the…

0

HorizontalTable.rdl

<?xml version=”1.0″ encoding=”utf-8″?><Report xmlns=”http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition” xmlns:rd=”http://schemas.microsoft.com/SQLServer/reporting/reportdesigner“>  <RightMargin>1in</RightMargin>  <Body>    <ReportItems>      <List Name=”list1″>        <Style />        <Height>1.25in</Height>        <Top>0.25in</Top>        <Grouping Name=”list1_Details_Group”>          <GroupExpressions>            <GroupExpression>=Ceiling(RowNumber(Nothing)/3)</GroupExpression>          </GroupExpressions>        </Grouping>        <Width>2.625in</Width>        <ReportItems>          <Matrix Name=”matrix1″>            <Corner>              <ReportItems>                <Textbox Name=”textbox1″>                  <Style>                    <PaddingLeft>2pt</PaddingLeft>                    <BorderStyle>                      <Default>Solid</Default>                    </BorderStyle>                    <PaddingBottom>2pt</PaddingBottom>                    <PaddingTop>2pt</PaddingTop>                    <PaddingRight>2pt</PaddingRight>                  </Style>                  <ZIndex>7</ZIndex>                  <rd:DefaultName>textbox1</rd:DefaultName>                  <CanGrow>true</CanGrow>                  <Value />                </Textbox>              </ReportItems>            </Corner>            <Height>1in</Height>            <Style />            <MatrixRows>              <MatrixRow>                <MatrixCells>                  <MatrixCell>                    <ReportItems>                      <Textbox Name=”CustomerID”>                       …

0

Dynamic Grouping

Question:How can I give my users the ability to dynamically select fields on which to group within a report? Answer:The key to dynamic grouping in a report is this:  Practically everything in a report can be based on an expression.  From grouping to column headers to column and row visibility… since all of it is…

0

DynamicGroup.rdl

<?xml version=”1.0″ encoding=”utf-8″?><Report xmlns=”http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition” xmlns:rd=”http://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>               …

0