The Matrix report item is also known as a cross-tab or pivot table. Matrix is capable of having a dynamic number of rows and columns and expands row by row and column by column. Matrix can act like a Table (fixed columns, dynamic rows) or like a pivot table (fixed rows, dynamic columns ) to transpose data ( turn rows into columns of data). Matrix allows you to group and sort rows and columns of data and can have multiple groups of rows or columns. Just like a table, each cell in a matrix contains a text box by default. Matrix also requires at least one row and one column group. Because of this requirement, the RDL of a matrix carries a <Grouping> section: <Grouping Name="matrix1_RowGroup1"> <GroupExpressions> <GroupExpression /> </GroupExpressions> </Grouping> This book uses a {GROUPING:{expression}} shortcut to abbreviate the appearance of this RDL. In turn, the {GROUPING} section is included in <RowGroupings> or <ColumnGrouping> sections, such as <RowGroupings> <ColumnGroupings> <RowGrouping> <ColumnGrouping> <Width>1in</Width> <Height>0.25in</Height> <DynamicRows> <DynamicColumns> {GROUPING} {GROUPING} {ITEMS} {ITEMS} </DynamicRows> </DynamicColumns> </RowGrouping> </ColumnGrouping> </RowGroupings> </ColumnGroupings> Later in the book, <RowGroupings> and <ColumnGroupings> sections are abbreviated as {ROWGROUPINGS} and {COLUMNGROUPINGS} , respectively. A simple matrix carries the following RDL. Note that DataSetName is for data regions during runtime. <Matrix Name="matrix1"> {POSITION} <MatrixColumns> <MatrixColumn> <Width>1in</Width> </MatrixColumn> </MatrixColumns> {ROWGROUPINGS} {COLUMNGROUPINGS} <DataSetName>DataSet1</DataSetName> <Corner> {ITEMS} </Corner> <MatrixRows> <MatrixRow> <Height>0.25in</Height> <MatrixCells> <MatrixCell> {ITEMS} </MatrixCell> </MatrixCells> </MatrixRow> </MatrixRows> </Matrix> Figure 11.8 demonstrates the design-time view of a matrix. Figure 11.8. Design-time picture of a matrix.You should note a couple of items related to Figure 11.8 (this book provides additional information on grouping in Chapter 12):
=IIF(Not InScope("matrix2_RowGroup1"), "LightGrey", "White") |