?
Solved

SSRS Dynamic Column Names

Posted on 2016-08-03
3
Medium Priority
?
136 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 2000 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 51

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

Industry Leaders: 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!

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

765 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