[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

SSRS Dynamic Column Names

I am creating a report where the SP returns a fixed set amount of columns although the column names are dynamic. Is there a way to have the report pick up on this and use the dynamic names, each time the report is run?
0
thinklings
Asked:
thinklings
  • 2
1 Solution
 
Nico BontenbalCommented:
Probably not. You options are very limited. Only if the range of possible column names is limited you could work around this limitation of SSRS. See the sample I've attached. The query returns the current seconds of the current time. The filed name is in the format 'fldx' where x is 0 to 5 depending on the first digit of the seconds. So if the current time is 11:49:34 the value is 34 and the fieldname is fld3. That gives me a Dataset with a dynamic column but I know the column will be fld0 to fld5. Also the Dataset has the column 'columnname' that returns the name of the column so I can use this to hide or show columns in my report. I also had to add all the possible column names manually to my Dataset. Then I can use this to show the value of the dynamic column:
=Fields(Fields!columnname.Value).Value

Open in new window


This result in a report that shows only the column that is actually returned by the query. But if they are the top 10 of your 50.000+ product list for example, this is not going to work.

See this blog post for another workaround:
http://sonalimendis.blogspot.nl/2011/07/dynamic-column-rdls.html

The best way to solve this is probably to adapt your query to have fixed column with dynamic data and then use that data to create a matix with dynamic columns.
DynamicColumn.rdl
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Maybe using a dynamic dataset?
0
 
Nico BontenbalCommented:
@Vitor Didn't you read the question, the article you link to, or both?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now