Export To CSV format
Hi,
I am using Reporting Services 2000. I would like to export the report to CSV format. The column header value is a field value based which can change every month(I am trying to get the current month).
For instance, the report will show
CUSTNAME JAN FEB
Jamie 100 200
When I Export that to CSV fiel in ASCII encoding, I get
CUSTNAME Period1 Period2
Jamie 100 200
The column headers are based on datafield name.
I understand that I can set the column header from the DataElementName property. However, I need the value to be based on a datafield value.
How can I achieve that?
Thanks in advance for any reply.
Risposte
Yit I think I found an answer at this post here:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1169873&SiteID=1
To eliminate column title row that you see before the data, use NoHeader option:
http://msdn2.microsoft.com/en-us/library/ms155365.aspx
You can use it with URL access (add &rc:NoHeader=true to report url), or, for RS 2005, you can configure your CSV rendering extension to always ommit the header row.
CSV renderer doesn't stack data from 2 different data regions, so your trick with table above matrix won't get you the result you are looking for.
- DenisL (SQL RS Team)
I am not sure if this will help you on RS 2000, but I was able to do it in RS2005 with some editing on my rsreportserver.config file.
<Extension Name="CSV" Type="Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,Microsoft.ReportingServices.CsvRendering">
<Configuration>
<DeviceInfo>
<NoHeader>True</NoHeader>
</DeviceInfo>
</Configuration>
</Extension>
Tutte le risposte
Hi Yit,
Output by data renderers (CSV and XML) is controlled by the DataElementOutput property on report items. By default, DataElementOutput is set to Auto, which means that all textboxes with expression-based values will be present in the data output. To control which parts of the report to be exported, please try to set DataElementOutput=NoOutput on the header.
If this doesn’t help, please post back to let me know.
Thank you.
Hi Yao-Jie,
Thank for your reply. I can't set the dataelementoutput=nooutput because I need that column to be exported to CSV. Let me define my scenario again.
My report will have a column header that is expression based value. When I view the report it will show the value of the expression,'=Fields!Mth1.Value' as 'NOV'. However, if I export the same report to CSV I will get 'Mth1' as column header in the CSV file instead of 'NOV'.
What other property that need to be set in order to get the CSV file to display the column header in 'NOV' value?
Thank you
Hi Yit,
May I know how you replace the ‘=Fields!Mth1.Value’ with ‘Nov’? Use Custom Code or something else?
Thanks.
I am pretty sure Yit means that '=Fields!Mth1.Value' would have a dynamic value of 'Nov' based on what the dataset holds.
I have a similar need. When someone exports to csv the very first line (which isn't in the original report) lists all the names on the cells exported like, Textbox1, Textbox2, etc. Where I'd like it not to, and just export what's displayed in the report on screen.
Yit I think I found an answer at this post here:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1169873&SiteID=1
To eliminate column title row that you see before the data, use NoHeader option:
http://msdn2.microsoft.com/en-us/library/ms155365.aspx
You can use it with URL access (add &rc:NoHeader=true to report url), or, for RS 2005, you can configure your CSV rendering extension to always ommit the header row.
CSV renderer doesn't stack data from 2 different data regions, so your trick with table above matrix won't get you the result you are looking for.
- DenisL (SQL RS Team)
I am not sure if this will help you on RS 2000, but I was able to do it in RS2005 with some editing on my rsreportserver.config file.
<Extension Name="CSV" Type="Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,Microsoft.ReportingServices.CsvRendering">
<Configuration>
<DeviceInfo>
<NoHeader>True</NoHeader>
</DeviceInfo>
</Configuration>
</Extension>
All way too heavy. Just go to the report, disgn view and change the name of the text box.
Cloggy

