Solved

SSRS Dynamic Column Names

Posted on 2016-08-03
3
108 Views
Last Modified: 2016-09-04
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
Comment
Question by:thinklings
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
Nico Bontenbal earned 500 total points
ID: 41744007
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
 
LVL 50

Expert Comment

by:Vitor Montalvão
ID: 41744010
Maybe using a dynamic dataset?
0
 
LVL 22

Expert Comment

by:Nico Bontenbal
ID: 41744028
@Vitor Didn't you read the question, the article you link to, or both?
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question