SSRS 2005 with dynamic columns in the report

  • If there are more than one way to have the dynamic columns in the report if so than what are those and which one is the best to use.

  • I'm not sure that there is anyway to have dynamic columns in a report. Do you mean that one time you would return 10 columns and the next 7?

  • If the amount of columns are reasonable to maintain, you may be able to hide individual columns should you wish to do so for a particular value and show only those you wish. Does that make sense?

    Brian K. McDonald, MCDBA, MCSD
    Business Intelligence Consultant
    Jacksonville, Florida

  • Hi Jack

    very thank you for your interest in the topic.

    I am having around 33 parameters to be passed on to the SSRS rpeorts. But on the basis of some initial parameters later parametrs are decided (dependent parameter).

    as you can say if you select a Account Manager in first parameter then the resources under that account manager are to be displayed under one table column.

    If we select any project it will show resources in it's table columns.

    Hiding the columns will not be a helpful for me for me because number of parameters can be changed in the future it can increase then rework will be required.

    Actually i am not running the reports on the SSRS server directly and not prompting the user for the parameters. Parameters will be passed from the front end and

    reports will be shown in reports viewer. so it is like a new reports generation all the time but I want only one report to be used as it is simple report

    without much formatting issue. columns are just dependent on the parameters passed.

    if it can be done by SP or any other way also then please help me.......:)

    Thanks

    Puneet

  • Puneet,

    I really think what you want is separate reports based on the parameters passed in. SSRS does not have a simple of way of having dynamic columns. If you will always have say 10 columns with dynamic content you could create an sp that always returns the same 10 column names and use the parameters to determine what your column headings are, but if you have 7 columns one time, 10 the next, and 14 after that, I don't know if that is possible in SSRS and any way I can think of it wold be simpler to have separate reports, especially when using ReportViewer in a .NET application.

  • Puneet,

    Unfortunately, your limitation will be on the SSRS side. The only thing that I can think of with the new details that you provided, would be to dynamically generate an .rdlc file on the fly. The reason being is that the code behind reports is actually just xml and inside this xml is the definition of the report. So, without the xml code in the rdlc to define the extra columns, it will not work. If you know xml pretty well, maybe your application can generate the xml and replace the already existing report with an updated one based on the params passed in. You will then have to have the report tied to the application (rdlc not rdl) and as such you will not gain the other benefits to hosting it on Report Server.

    I hope this helps,

    Brian K. McDonald

    Brian K. McDonald, MCDBA, MCSD
    Business Intelligence Consultant
    Jacksonville, Florida

  • This is what I did.

    A unique id/number determined what number of columns were needed when the report is created. The report is developed with the maximum number of columns, say 11 columns. Therefore 11 heading fields, and 11 value fields = 22 fields.

    In a procedure, for each unique id/number (I had 21 reports using the same report layout), I always get the same number of heading and value fields, always 22. And it always has the same generic name, heading01, heading02, ... value01, value02, ... I also passed the report heading like this.

    The unique id/number determined what data is passed and displayed on the report. (passed from a parameter list on the report to the procedure to get the result).

    When I only needed 6 of the 11 values, I passed a blank for the last 5 heading and value fields, which will not be used. In the column expression, for the headings and value fields that will not be used at all times, I used the unique id/number to either hide or display the heading or value field, and also to do some formatting.

  • Hi

    Here is the step by step process to show dynamic dataset in SSRS reports using tables

    http://sivakrishnakuchi.blogspot.com/2010/02/how-to-show-dynamic-columns-in-sql.html

  • I have proposed a step by step solution here.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply