Solved

SSRS Dynamic Column Names

Posted on 2016-08-03
3
66 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
  • 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 47

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert formula to max at a specific date by month 18 21
How to share SSIS Package? 6 37
Query Help - MSSQL - Averages 5 27
Sql Query 6 67
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

803 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