views:

50

answers:

2

I have a dynamic pivot request I would like to present in a report of Reporting Services.

As it is dynamic, the number of columns of the result is variable (as is the name of the columns). How could I create a report showing a table handling this variable number of columns ?

+1  A: 

You will need to implement a dynamic report definition file. Here is a link that will help you get started. It is a VS Project that dynamically creates a RDLC file with a table, via a datatable. I used it as the base of my current report system.

C# Version

VB.NET Version

If you have any questions about this, let me know. I've been generating RDLC files for quite a while now, and encountered pretty much every issue you could think of :)

Jon
Thanks a lot for your help. I am completely stuck on this. I must admit I would have preferred a solution that would not force me to learn c#, but thanks anyway.
madewulf
+1  A: 

You can also use the Matrix control to pivot the results in the report instead of in the query. This way you don't have to use any custom solution.

Zaid Zawaideh
In fact, I also had to add many static columns on the left of my dynamics columns, and so, I felt that I needed to make a join on the result of my pivot request before handing it to reporting services. I finally managed a solution, but it is a bit of a hack : I used a matrix control, and then, in the left column, I splitted the field in as many textboxes as necessary, where I showed the different fields I needed. Then, formated the top left cell to simulate that it is multiple table headers.
madewulf
What I usually do is insert the static columns in the same field as my dynamic columns in my query and have everything dynamic. This way your matrix is easier to maintain :). Glad it works
Zaid Zawaideh