Recent question that popped up from an user was how to create a table, where the table grows horizontally instead of vertically. This is easy as one, two, three when using our Table report item.

I start off using the crosstab item as initial template for this task. As the table would be growing "in columns" instead of "in rows", we do not need a row group so we delete it. Then bind the crosstab to a sample business object making sure we've added as many static rows as we need. Next step in order to show all the data, we need to make sure that the column group has an empty string as grouping criteria i.e. it becomes details group. Just to be clear, depending on the grouping criteria, we have:

  • Dynamic groups - have any Grouping expression, ex. group1.Grouping.Add(new Grouping("=Fields.Country")). For the dynamic groups, the corresponding row/column will repeat for every record of the grouped data.
  • Static groups - no grouping criteria at all. For the static groups the corresponding row/column is rendered only once.
  • Detail groups -have a single empty grouping, ex. group1.Grouping.Add(new Grouping()). Usually you have only one row -or- column detail group. For a detail group the corresponding row/column is repeated for every row of the Table's data source. You may think of the detail TableGroup as the Report's Detail section.

More information on the Table/CrossTab can be found in our documentation here.

And here is the final result:

Horizontal Table

I've attached a short video of the horizontal table creation process, as well as with the final report.

[]           []


About the Author

Stefan Tsokev

Stefan’s main interests outside the .NET domain include rock music, playing the guitar and swimming.

Related Posts


Comments are disabled in preview mode.