Friday, March 9, 2012

How to add columns at run-time?

I have a table:

column1 column2 column3 column4

data data data data

data data data data

I want to create more columns at runtime, what should I do?

desired output:

column1 column2 column7 column3 column4 column5 column6

data data data data data data data

data data data data data data data

The number of columns to be added is random. Please help.

Unless you pre-process the report definition programatically before the report is rendered, you can't add/remove columns. So your options are:

1. Define the maximum number of dataset fields and conditionally hide the columns you don't need.

2. Use the matrix region to rotate dataset rows to columns (crosstab report).

|||

I have not yet tried using the matrix component, I can't find any samples in the web. I have created a dataset for the column names alone but i'm having a problem mapping the data under it.

here's the type of the table i'm trying to do:

column1 column2 column3

data1 data2 data3

data3subA

data3subB

data4 data5 data6

and so on...

I have some columns that have more rows than the others. In my example column3 have 2 extra rows. If this can be done using a matrix then please direct me to tutorial or something. Thanks. :D

|||You could look into using nested tables. You'd have to predefine the number of columns at each level. I haven't tried it myself but I think it fits your requirements.|||I didn't know I could place a table inside a table cell. The tables have still fixed columns even though I predefine the number of columns to be inserted.|||

The matrix region can have row and column groups. The column groups rotate rows to columns. The row groups on rows. Please take a look at the Company Performance report which comes with the RS sample reports.

|||What if I don't want to display the rows group? How can I remove the column for rows group?|||And where can I get the samples? Can someone please point me to the link... Thanks!|||Assuming you installed them during setup (under Client Tools), by default the samples are installed in the C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Report Samples\AdventureWorks Sample Reports folder.|||One row group is required at least.|||

Hi,

A good example for "Horizontel Tables" can you find at:

http://blogs.msdn.com/chrishays/archive/2004/07/23/HorizontalTables.aspx

Hans

|||

Adam Tappis - IMGroup wrote:

You could look into using nested tables. You'd have to predefine the number of columns at each level. I haven't tried it myself but I think it fits your requirements.

I get an error when I do this. The data comes from 2-3 datatables. And I can only add one datasetname property for the main table.

|||

Hans Preuer wrote:

Hi,

A good example for "Horizontel Tables" can you find at:

http://blogs.msdn.com/chrishays/archive/2004/07/23/HorizontalTables.aspx

Hans

Is there a simpler one, is there a good reading on how to use the matrix component?

|||

Teo Lachev wrote:

Assuming you installed them during setup (under Client Tools), by default the samples are installed in the C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Report Samples\AdventureWorks Sample Reports folder.

I don't have a Samples folder.

No comments:

Post a Comment