Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS report formatting a table to display data side by side

I am trying to achieve the following layout for my report based on one query.

+----+-------+----+-------+
| ID | Name  | ID | Name  |
+----+-------+----+-------+
|  1 | Danny |  2 | Dave  |
|  3 | Sue   |  4 | Jack  |
|  5 | Rita  |  6 | Sarah |
+----+-------+----+-------+

So I basically want one table, printing my data from left to right to save space on my page, rather than it printing one line and wasting all of the space on the right side of the paper, possibly even go 3 times across the width.

This is my data: http://sqlfiddle.com/#!3/5c911/1

I was maybe thinking a table with 4 columns. Cols 1 and 2 contain the odd row numbers, Cols 3 and 4 contain the even row numbers.

How could I achieve this, I did try something with the MOD function but it didn't seem to work properly, or I misunderstood what was happening.

Related: How can I display two rows worth of data on one line side-by-side in Report Designer?

Thanks,

like image 629
Danny Cullen Avatar asked Dec 05 '12 10:12

Danny Cullen


1 Answers

To print your data from left to right in a multi-column format, you need to fake it using multiple tables. To implement this hack, create the same number of tables as columns you want side by side that all point to your data set. On the Detail row of the first table, for the Visibility-Hidden property use the following formula:

=IIF((RowNumber(Nothing) Mod 4) = 1, False, True)

where 4 is the number of tables (columns) you have.

Do the same for each table, incrementing what the formula is equal to (so for the second column (RowNumber(Nothing) Mod 4) = 2 and so forth). In the last table (column) the formula equals 0.

This alternately hides the detail row, only displaying the appropriate rows for that column number.

like image 92
Chris Latta Avatar answered Sep 22 '22 16:09

Chris Latta