Table Report Item


Table presents data with static columns and expands row by row. Table allows you to group (a table can have multiple groups) and sort rows of data. See Chapter 12 for more details.

Table has the best performance of all data regions . A cell in a table is a text box by default, but can be replaced with any other SSRS item, such as an image. A default table placed on a report contains three rows and three columns.

You can interact with row, group, and column handles within the Report Designer interface to adjust table layout. If handles on the designer window are not visible, click on any cell within the table. Adjustment is very similar to that in Microsoft Excel and can be done by dragging adjustor lines or specifying Height and Width properties. See Figure 11.4 for design-time view of a table in Report Designer.

Figure 11.4. Design-time view of a table.

Each row on a table can be deleted or an additional row of the same type can be inserted. For example, a table can have multiple table detail, table header, table footer, group header, and group footer rows.

To add an additional group header row, click on a row handle and select Insert Row Above or Insert Row Below from the drop-down menu. You can delete a row in a similar fashion. For example, Figure 11.4 demonstrates an empty space created by a retained table header row. To remove a row, right-click on the row handle and select Delete Rows from the shortcut menu.

It is possible to first delete all rows of a certain type, such as table header. To reverse this operation, consult the following list, which shows a set of procedures for different types of rows:

  • For table header, footer, or detail rows, right-click on any row handle and select Table Header, Table Footer, or Table Detail from the shortcut menu.

  • For a group that has at least one group header or group footer left, right-click on any header or footer row and select Edit Group from the shortcut menu. When the Grouping and Sorting Properties dialog box is displayed, check an appropriate text box to include a group header or footer or both. This book discusses more details about grouping in Chapter 12.

  • For a group that does not have any rows left on a table (yes, it is possible to have a group that has no rows displayed), click on the table's corner handle and then right-click on the table to bring up the Table Properties dialog box. Select the Groups tab. Select and edit the group to bring up the Grouping and Sorting Properties dialog box. Check an appropriate text box to include a group header or footer or both.

To add data to a table in a simple scenario, you can drag and drop to a table's cell field from the Datasets window (which, in turn , drops a text box) or any report item to a cell. When the first field is dropped on a table, Report Designer sets the table's Dataset property to match the name of the data set from which the field came.

As you can see in Figure 11.4, a row that displays subtotal information is the group footer. This book discusses more details of grouping in Chapter 12. In addition to subtotals, a table has header and footer rows for calculation of total numbers .

A simple one-cell Table RDL is broken down into components in Table 11.3.

Table 11.3. Table's RDL Explained

Element

Explanation

 <Table Name="table1"> {POSITION} 

Opening tag and table's position on a report.

 {ROW TYPE TAG} 

Type of a row. Depending on the type of the row (see design picture), this could be either <Details>, <Header> , or <Footer> .

 <TableRows> 

Table can contain multiple rows of each type.

 <TableRow> <Height>0.25in</Height> 

Row definition. If the table has a single row, the height is equal to the height of the table. If the developer specified a value for this table's Height property, the entire table is sized , proportionally reducing or increasing the height of each row.

 <TableCells>      <TableCell>         {ITEMS}       </TableCell>    </TableCells> 

Cell definition. Each table cell could be any report item.

 </TableRow>     </TableRows>   {CLOSING ROW TYPE TAG}  <Style /> 

Closing tags. {CLOSING ROW TYPE TAG} could be either </Details>, </Header> , or </Footer> .

 <TableColumns>     <TableColumn> <Width>2.16667in</Width>     </TableColumn>   </TableColumns> </Table> 

Collection of columns. If the table has a single column, this is equal to the width of the table.


Tip

When possible, use a table for best report performance.


Multiple adjacent table cells can be merged horizontally into a single cell across multiple columns. Unlike Excel or Microsoft Word, SSRS table cells cannot be merged vertically even across the same type of rows, such as a detail row. Report Designer only preserves data from the first cell. Data in other merged cells is discarded. Report Designer allows you to split back to the original columns.

To merge or split cells, select the cells, right-click the selection, and then select Merge Cells or Split Cells, respectively, from the shortcut menu (see Figure 11.5). Alternatively, Report Designer provides a toolbar button to perform this operation. The toolbar button icon is the same as the icon on the menu.

Figure 11.5. Merging table cells.



Microsoft SQL Server 2005 Reporting Services
Microsoft SQL Server 2005 Reporting Services
ISBN: 0672327996
EAN: 2147483647
Year: 2004
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net