SSRS 2008 Column issue when exporting to a CSV file
Hello I have built an SSRS 2008 report that I will be exporting the data into a CSV file everytime the report is run. The problem that I am having is that the fields in the CSV file have to be in a particular way because the CSV file will imported into another web application system. In my query my fields are set as illustrted below: [Phone #] [Mobile #] [Street Address] [Other Name(s)] However when I export the data into a CSV file it sets it as this: Phone__ Mobile__ Street__Address Other_Name_s_ I need the columns when exported to a CSV file to display as follows: Phone # Mobile # Street Address Other Name(s) Does anyone know how to resolve this issue with SSRS 2008?Kajoo
November 10th, 2009 9:39pm

Hello Kajoo,UniCode and ASCII conversation issue, Could be, please have a lookhttp://behindthecode.net/Blog/post/2008/01/29/How-to-modify-Reporting-Services-CSV-export-Behavior.aspxThanks
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2009 12:27am

Under the this code:<Extension Name="CSV" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering"/> I added the following to the rsreportserver.config under the <DeviceInfo> <NoHeader>true</NoHeader> <Encoding>ASCII</Encoding> </DeviceInfo> But it did not solve the problem. When I export to a csv file the columns are still there and are in the same format as they were before.Thanks Kajoo
November 12th, 2009 8:35pm

Is there a way to set up the properties to use the Text box as the header when exporting to a CSV file?Kajoo
Free Windows Admin Tool Kit Click here and download it now
November 12th, 2009 9:13pm

Hi Kajoo,For csv export, the header of a column is determined by the DataElementName property of the textbox which actually contains the data. Ifthe DataElementName property is not explicitly set by the user, DataElementName automatically gets defaulted to the value of the textbox.Name property. That being said, I believe you're getting this issue because RDL has a restriction that both a reportItem.Name and reportItem.DataElementName property must be CLS-compliant identifiers (see http://www.unicode.org/unicode/reports/tr15/tr15-18.html). The headings that you want ("Phone #", "Other Name(s)", etc...) are not CLS-Compliant. You can verify this by opening up the report in BIDS or RB and trying to set the DataElementName/Name property of the textbox containing the data to those names. You will get an error which states the following: Property Value is not valid. Specify a valid name. The name cannot contain spaces, and it must begin with a letter followed by letters, numbers, or the underscore character (_).HTH,KeKe Xu - MSFT Reporting Services
November 12th, 2009 9:49pm

.Hi Ke Yu and everyone else reading this thread. I have been searching for 2 days now trying to find a solution to my problem with column header rendering in CSV when exporting a SSRS 2008 report to CSV format but I have not found a solution that works for me. Everything I tried has absolutely no effect on the output or the effect is not what I need. I tried setting the DataElementName and DataElementOutput properties to get the headers to show as they should, but it does not work for me. I either get no chance at all, or I end up with additional columns in the exported file with the DataElementName as the header for the new column and as the value in every row. Here is what my report looks like in Excel, HTML or any other format available in SSRS, except CSV of course. Customer ID Customer Name State City Sales Territory Sales Region Expiration Point Balance 156280 First Customer Name NE OMAHA 34 HL 0 468672 Second Customer Name CO DENVER 44 W 0 And this is what it looks like in CSV: Textbox18 Textbox16 Textbox14 Textbox12 SalesTerritory SalesRegion ExpirationPointBalance 156280 First Customer Name NE OMAHA 34 HL 0 468672 Second Customer Name CO DENVER 44 W 0 All the columns are in the details group, there are no sorts or hidden fields or dynamic headers. It is really as simple as it looks: A list of customers, some info about each customer and a point balance. This report is about as simple as it can be. I see no reason to have a details group and neither created it no did I place any columns in the details group but SSRS seems to need it. I tried removing the group but the output was incorrect when I did that. The report contained only 1 row when I remove the detail group (Selecting the "Remove Group Only" option). I was surprised by that. It seems the details group is required, though I don't see why it should be. The query I use to get the data does not group the data either, but it includes an "Order By" clause. I already mentioned that my DataElementNames are set for all column headers. I entered the same values I used on the Textbox but removed any spaces and I had to shorten the ExpirationPointBalance name to PointBalance because the DataElementName property would not allow me to enter the full name. I suspect the string is too long. When I change the DataElementOutput property for all the columns to "OutPut", the report looks like this when exported to CSV: CustomerID CustomerName State City Territory Region PointBalance Textbox18 Textbox16 Textbox14 Textbox12 SalesTerritory SalesRegion ExpirationPointBalance Customer ID Customer Name State City Territory Region Expiration Point Balance 156280 name 1 NE OMAHA 34 HL 0 Customer ID Customer Name State City Territory Region Expiration Point Balance 468672 Name 2 CO DENVER 44 W 0 Customer ID Customer Name State City Territory Region Expiration Point Balance 519729 Name 3 NJ ENGLISHTOWN 11 NE 0 Customer ID Customer Name State City Territory Region Expiration Point Balance 526863 Name 4 NC CHARLOTTE 25 SE 0 Customer ID Customer Name State City Territory Region Expiration Point Balance 670896 Name 5 AZ GLENDALE 46 W 25 Customer ID Customer Name State City Territory Region Expiration Point Balance 472014 Name 6 NY ORCHARD PARK 12 NE 50 Customer ID Customer Name State City Territory Region Expiration Point Balance 16061 Name 7 NY BROOKLYN 5 NE 0 I hope that looks ok when it is posted. The lines are very long and they may wrap. The important thing about the sample output is in the first 7 columns though so I am hoping you can still see what happens when I set DataElementOutput to OutPut and enter a value for DataElementName. Please note that I changed the values in the Customer Name column for each sample to protect the privacy of our customers and I had to change the spacing between some columns so the values line up with the headers but I made no other changes. This is the exact output as it appears in each version of the report. The only suggestion I have not tried is to set the NoHeader option to True in the SSRS configuration file, because the people who will use this report would rather have the weird headers than none at all. So changing the config file to skip the headers is not an option. I have tried every other option to fix this I have been able to find. As far as I know, this is the only report that shows this problem when exported to CSV but that could be because CSV export is not used by many people here. Most export to Excel. Do you have any suggestions for fixing this? I am at a loss. I have tried everything I could find that did not require changes to the config file but nothing works! Any and all ideas would be greatly appreciated. Thanks for reading. URW PS: After I submitted I saw that the report samples lines did indeed wrap as I feared, making the sample difficult to read. I don't know what to do about it though. The only thing I can think of is to copy the samples and paste them into a text file or a Word document and then edit the rows so they fit a single row. I used the Insert Code Block option to insert the samples. If you have a better idea or suggestions to fix the way the report samples are displayed, I'd love to hear it.
Free Windows Admin Tool Kit Click here and download it now
March 31st, 2011 12:50pm

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

Other recent topics Other recent topics