1

One of the reports I am creating has dynamic number of columns - a datatable gets returned from the stored procedure, the number of columns depend on the number of items defined in the database (one column for each item, other than some fixed columns).

Is it possible for me to use RDLC report to generate a report in this case? All the calculations are already done int he report, I am looking at RDLC only for the sake of export to excel/pdf and repeating header/footer.

Roopesh Shenoy
  • 3,389
  • 1
  • 33
  • 50

4 Answers4

1

It is possible, but there is no simple solution. Here is a link to a former answer of mine on this topic.

An additional investigation later

Here is an article describing the mentioned report generation with a self generated RDL object model in detail.

Community
  • 1
  • 1
Dirk Brockhaus
  • 4,922
  • 3
  • 38
  • 47
  • But this seems to deal with sql server based reports - I need to generate the report from a datatable. – Roopesh Shenoy Nov 24 '10 at 17:36
  • The RDLOM part of the linked answer is sql server based, but RDLOM seems to be a dead end and therefore of no actual interest. The self generated object models work with or without SQL server. You can use them in Visual Studio in a disconnected scenario with data tables. – Dirk Brockhaus Nov 25 '10 at 07:54
  • You are referring to this link right? http://msdn.microsoft.com/en-us/library/aa337455%28SQL.90%29.aspx. I did not understand how that connects to this - all I can see is how to edit the report definition locally. Could you elaborate a bit more on how to dynamically generate the object model? – Roopesh Shenoy Nov 25 '10 at 10:33
  • O.. now I am sort of beginning to understand what you are saying - let me try that out.. you truly deserve the bounty if this works! – Roopesh Shenoy Nov 26 '10 at 11:12
  • I have started on this, and though this is cumbersome, I think this is the only possible way out. Thanks a lot, this has been a good learning! – Roopesh Shenoy Nov 30 '10 at 06:52
0

For your Problem,

I guess you can go for matrix instead of tables. where you can generate rows and columns dynamically according to the data you are getting.

Check here for using of matrix

Mp0int
  • 18,172
  • 15
  • 83
  • 114
Zara
  • 291
  • 4
  • 19
0

From the sounds of it, you want your report to pivot defined items, which can change with respect to various report criteria. If you know all the columns that COULD come back, you could just define your RDL to bind them all but hide the ones that aren't item defined. You would just have to bind the Visible property of the column to a determination of whether the has been defined.

bitxwise
  • 3,534
  • 2
  • 17
  • 22
  • No, I don't know what are the columns that COULD come back - that's because this is a product and the columns will depend on the items that each customer defines. Hence the column names can be totally different for each installation of this product. – Roopesh Shenoy Nov 28 '10 at 11:08
0

Use matrix in RDLC whenever your columns are not fixed in datatable.

Visit http://www.gotreportviewer.com/matrices/

Here you'll find use of both table and matrix in RDLC. See yourself which one suits for your requirement.

DarkRob
  • 3,843
  • 1
  • 10
  • 27