Dynamic Columns to Tablix

  • Hello

    I have a stored procedure which generates data from some X table(this table is an input to the stored procedure at runtime) with some columns(this columns are decided at runtime as input to stored procedure).

    I m using this stored procedure as dataset to my report. As columns are dynamic I cannot set the columns to tablix while creating the report. Is there any way to set the columns dynamically to the tablix based on the output of the stored procedure?

  • gajayku (11/4/2014)


    Hello

    I have a stored procedure which generates data from some X table(this table is an input to the stored procedure at runtime) with some columns(this columns are decided at runtime as input to stored procedure).

    I m using this stored procedure as dataset to my report. As columns are dynamic I cannot set the columns to tablix while creating the report. Is there any way to set the columns dynamically to the tablix based on the output of the stored procedure?

    It's unclear what you mean by "set the columns". Do you mean that you need a dynamic number of columns, do you need to dynamically change the column headers, or what?

    For dynamically changing the number of columns, there are two different approaches. The first approach is for when you know that you'll need 5 columns, or 7 columns, or 12 columns, but never 6,8,9,10,11. In short, your options are fixed. In this instance, you can simply create three distinct tablix table objects, each one customized for the column count. Then make the correct table visible based on your parameters.

    The second option is more flexible, but there are sometimes good reasons for not using it. Simply use a matrix flavored tablix. This may require changing the structure of your dataset to support the column grouping, but it allows a practically unlimited number of columns.

    For dynamically setting the column header(s), just add fields named ColumnHeader1, ColumnHeader2, etc to your dataset and use those.

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

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