SSRS - Display column header from dataset
My report uses a stored procedure to return a dataset. I want to be able to use the column name from the dataset as my column header in the Report. How can this be achieved? Sanjeev.
August 8th, 2012 6:56am

Hi, You can use expression in the column header textbox to fetch the max value for a column from dataset. Please revert if this is not the same you want.- Chintak (My Blog)
Free Windows Admin Tool Kit Click here and download it now
August 8th, 2012 7:06am

Hi, Fetching the max value for a column will return the max value from the column isn't it? I'm looking to display the column name from the dataset as my column header in the report. Sanjeev.
August 8th, 2012 7:14am

As far as I know, you can't access the name of a dataset field. So to be able to load your column names dynamically, the only option that I see is by adding an additional "label" field for your available columns to your dataset. Imagine you'd have a column called Col1, you could then add an additional field called Col1Label which has "Col1" as value. That will allow you to make the header names dynamic.MCITP SQL Server 2008 (DEV); MCTS SQL Server 2008 (BI, DEV & DBA)
Free Windows Admin Tool Kit Click here and download it now
August 8th, 2012 9:30am

I've found a better way, using subreports. Each report having its own dataset. The dataset for the main report returns 1 row only with the actual column names, which are used for the column headers: Col1 Col2 Col3 Col4 Jan-12 Feb-12 Mar-12 Apr-12 The subreport dataset returns the actual data you can have a nice tutorial on subreports at this link: http://www.codeproject.com/Articles/195017/SSRS-Series-Part-II-Working-with-Subreports-DrillD Sanjeev.
August 9th, 2012 3:54am

It depends a bit on the situation, but perhaps you don't even need to use a subreport. Possibly you could put two tables right above each other. The first would contain only one line displaying the header names, coming from DataSet1. And the second table would display the data from DataSet2.MCITP SQL Server 2008 (DEV); MCTS SQL Server 2008 (BI, DEV & DBA)
Free Windows Admin Tool Kit Click here and download it now
August 9th, 2012 4:19am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics