SSRS 2008 R2 CSV header output
Let me say up front that I WANT the header output on the CSV export (I've seen too many threads where people answer the question I'm about to ask by giving information about how to turn the header off). When you pull fields from your DataSet over to a Tablix, the field is autocreated with a header. The header gets the same name as the field name. I change many of my headers to be more English like. For example the field in the query might be "Folder1" and I want the header to display "Business Group" When I run my report, the changes I made to the headers displays great. In the example above I see "Business Group" When I export to Excel the changes I made to the headers displays great. In the example above I see "Business Group" When I export to CSV, the header values that show are the original names of the data fields themselves. In the example above I see "Folder1" How can I tell the CSV export to use the custom header values I've indicated in the design? The only thing I can think of right now is to alias the return fields from the query which gets ugly since I use lots of spaces and special characters in those header values.
June 21st, 2011 3:17pm

Hello, For export to CSV or XML you can use the DateElementName to change the CSV header / XML element name.Olaf Helper * cogito ergo sum * errare humanum est * quote erat demonstrandum * Wenn ich denke, ist das ein Fehler und das beweise ich tglich Blog Xing
Free Windows Admin Tool Kit Click here and download it now
June 21st, 2011 3:29pm

I am creating these reports using the Business Intelligence Studio. When I try to change the DataElementName property it won't let me and gives me this message: "Specify a valid name. The name cannot contain spaces, and it must begin with a letter followed by letters, numbers, or the underscore character (_)." Almost every header I have as at least once space and some have special characters. This won't work for me. Any other ideas or any ways to get around this restriction?
June 21st, 2011 4:30pm

Hi NElliott01, I can reproduce this scenario in local environment with the latest CU, it seem this is by design. To work around the issue, you can modify the filed name to a more readable word, steps are below: 1. Right-click the dataset name and select DataSetProperties. 2. Move to Fields tab, you will see two columns: Field Name and Field Source--field name is the label you display on the column header; Filed source is the field from database. 3. You can change the Folder1 in Field name column to BusinessGroup, note: make sure there is no space between the words, otherwise you will receive the error you posted. 4. Drag the field to your report item's header, a blank space will be added automatically to Filed name such as: Business Group, but after exporting to CSV, the blank space will be ignored, just show BussinessGroup. Of course this is just a work around not a grace solution, if you have any concern about this behavior, here I still would recommend you to submit a feedback to Microsoft Connect at this link at this link https://connect.microsoft.com/SQLServer/Feedback This connect site is a connection point between you and Microsoft. Your feedback enables Microsoft to make software and services the best that they can be, Microsoft might consider to add this feature in the following release after official confirmation. Regards, Challen Fu Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2011 4:54am

Thanks for the detailed reponse. As a result of this I will code my stored procedures to alias each field returned with spaces in them so that SSRS picks them up and automatically adds "_" where the space was. Then when I drag the field over to the layout, the "_" is automatically converted to a space and in the CSV the field is named the same but with the "_". Thanks!
July 3rd, 2011 7:27am

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

Other recent topics Other recent topics