Preparing Data for Display in a Tablix Data Region (Report Builder 3.0 and SSRS)
A tablix data region displays data from a dataset. You can view all the data retrieved for the dataset or you can create filters so that you see only a subset of the data. You can also add conditional expressions to fill in null values or modify the query for a dataset to include columns that define the sort order for an existing column.
You can create and modify report definitions (.rdl) in Report Builder 3.0 and in Report Designer in Business Intelligence Development Studio. Each authoring environment provides different ways to create, open, and save reports and related items. For more information, see Designing Reports in Report Designer and Report Builder 3.0 (SSRS) on the Web at microsoft.com.
Data for the field collection in a dataset includes all values retrieved from the data source at run time, including null values and blanks. Normally null values and blanks are indistinguishable. In most cases, this is the desired behavior. For example, Numeric aggregate functions like Sum and Avg ignore null values. For more information, see Aggregate Functions Reference (Report Builder 3.0 and SSRS).
If you do want to handle null values differently, you can use conditional expressions or custom code to substitute a custom value for the null value. For example, the following expression substitutes the text Null wherever a null value occurs in the field [Size].
=IIF(Fields!Size.Value IS NOTHING,"Null",Fields!Size.Value)
For more information about eliminating nulls in your data before retrieving the data from a SQL Server data source using Transact-SQL queries, see "Null Values" and "Null Values and Joins" in the SQL Server documentation in SQL Server Books Online.
Testing for null values in an expression is fine as long as the field itself exists in the query result set. From custom code, you can test whether the field itself is present in the collection fields returned from the data source at run time. For more information, see Using Dataset Fields Collection References (Report Builder 3.0 and SSRS).
By default, you can alphabetically sort values in a dataset field. To sort in a different order, you can add a new column to your dataset that defines the sort order you want in a data region. For example, to sort on the field [Color] and sort white and black items first, you can add a column [ColorSortOrder], shown in the following query:
SELECT ProductID, p.Name, Color, CASE WHEN p.Color = 'White' THEN 1 WHEN p.Color = 'Black' THEN 2 WHEN p.Color = 'Blue' THEN 3 WHEN p.Color = 'Yellow' THEN 4 ELSE 5 END As ColorSortOrder FROM Production.Product p
To sort a table data region according to this sort order, set the sort expression on the detail group to =Fields!ColorSortOrder.Value. For more information, see How to: Sort Data in a Data Region (Report Builder 3.0 and SSRS).