Symptom
- Random rows of commas are displayed in a Comma Separated Values (CSV) document.
- Exporting a report from Crystal Reports to Comma Separated Values (CSV) format, generate a file with random rows of commas.
Environment
- SAP Crystal Reports 2013
- SAP Crystal Reports 2016
- SAP Crystal Reports 2020
Reproducing the Issue
-
In Crystal Reports, create a report off any data source, and insert a least 2 database fields in the details section.
-
Create a conditional suppression on the details section, or Group Header or Footer section.
-
Under the menu "Report", select "Section Expert"
- In the "Section Expert" window, select the details section.
- Then click on the "X-2" button, of the suppress option, and create a conditional formula that will suppress the details section.
- For example, conditionally suppress the details section if the sales amount is less than 100.
-
Export the Report to Comma Separated Values (CSV) Format.
- When opening the CSV document, you will notice there is random lines displaying commas like:
- Canada, Vancouver, ABC, 100
- ,,,
- USA, Seattle, DEF, 200
- ,,,
- ,,,
- Mexico, Mexico City, GHI, 300
Cause
-
Conditional Suppression for a section is unfortunately not supported when exporting to Comma Separated Values format (CSV), and therefore this is why it add what appears to be extra lines filled with commas, but those lines are actually the conditionally suppressed sections.
Resolution
-
Depending on the report design, and the complexity of the report, it is sometime possible to workaround this situation by modifying the report design by creating a formula that output the desired format, and export the report to text. Below are the general steps on how to do so:
-
Modify the Report to insert all the Database Fields and Formulas you have for a row of data into one text objects.
-
Add commas and the desired delimiter for text, like quotations, within the text objects, so the report output will look like:
-
"USA","Seattle", 100, "April 10, 2010"
-
"Canada","Vancouver", 200, "March 20, 2010"
- Export the report to "Text" Format.
Keywords
Conditional Suppression, CSV format, Exporting to CSV format, rows of commas, ADAPT01323505 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem
Product
SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020