cancel
Showing results for 
Search instead for 
Did you mean: 

Doesn'rt export a valid CSV file if you use conditional suppression

0 Kudos
We have written lots of crystal reports which are to export to a CSV to provide interfaces to other software, Sometimes we want to suppress particular lines from the output. Usually you can do this by using record selection criteria - which works just fine. However, sometimes you need to suppress a group summary or even one or more detail lines based on information that can't be determined at record selection time.
I am using conditonal suppression by putting in a suppression formula for an entire section eg details or group footer sectrions.
If we put in conditional suppression on these lines and we export to a CSV file then the field data from the lines is suppressed (which is good) but the actual line itself is not suppressed so we get a loine of commas. So you get output that looks like this =========================================================================
Hours Code,Description,Short Description,Classification,Classification Description
,,,,
,,,,
30,PUB HOL WKD 1.4 CAS,PH 1.4,P,Public Holiday.
31,NORMAL 140,NORM 140,N,Normal pay hours. 32,PPL,PPL,O,Other Leave.
,,,,
33,O/T 1.75,O/T 1.75,T,Overtime.
34,NORMAL - OUTSIDE 6-8,NORMO6-8,N,Normal pay hours.
35,CAS O/T 1.6,CO/T 1.6,T,Overtime.
,,,,
38,NORMAL 180,NORM 180,N,Normal pay hours.
39,W/COMP EXCESS,W/COMPEX,W,Workers Compensation. =========================================================================
when it SHOULD look like this ... ========================================================================= Hours Code,Description,Short Description,Classification,Classification Description
30,PUB HOL WKD 1.4 CAS,PH 1.4,P,Public Holiday.
31,NORMAL 140,NORM 140,N,Normal pay hours.
32,PPL,PPL,O,Other Leave.
33,O/T 1.75,O/T 1.75,T,Overtime.
34,NORMAL - OUTSIDE 6-8,NORMO6-8,N,Normal pay hours.
35,CAS O/T 1.6,CO/T 1.6,T,Overtime.
38,NORMAL 180,NORM 180,N,Normal pay hours.
39,W/COMP EXCESS,W/COMPEX,W,Workers Compensation. =========================================================================
So you can see the first example has several lines which just contain a row of commas. Now if I export this same report to an EXCEL file then it does exactly what it supposed to do and truly suppresses the lines we don't want to appear and there are no lines of commas or blank rows in Excel. I presume that if I export to PDF or any other format I get proper suppression of this data as well. This issue is in every version of Crystal Reports I've tested it in including 2020, 2013, 2008, XI, 10, 8.5, 5 and 4.5 Why doesn't this work?
Or is there some trick to making it work? We have to jump through all sorts of hoops to get around this - like running a report to generate the data that displays the problem and then running another report on the exported data to clean up the rubbish that was exported. By the way, I tried to use your CHAT app on this website but when I asked to chat, and someone said HI, there was nowhere I could type anything in to reply. I couldn't even ask what to do to correct it because I couldn't type anything in anywhere. (It's like your internet service provider telling you to go look on their website to see if there are any outages when you ring up to tell them you have no internet access).

Accepted Solutions (0)

Answers (4)

Answers (4)

ido_millet
Active Contributor
0 Kudos

One of the 3rd-party Crystal Reports automation tools listed here allows you to overcome CSV export limitations in several ways.
For example, it can automatically export to Excel (Data Only) and convert that to CSV.

0 Kudos

I can certainly write a program to export to excel and then convert the excel file to csv but that isn't the issue. The issue is that Crystal Reports doesn't produce a valid CSV file if you have use conditional suppression in the report. I am asking that a whole section be suppressed buut Crystal reports is suppressing the data fields in that section and then exporting the section. I don't want a crude workaround - I want the program to work as it should.

If anyone tells me that they WANT the current behaviour then I'd be amazed.

The current behaviour exports a line of commas for each section that you have conditionally suppressed and I can't see why anyone would want that in the output. When you tell crsytal reports to suppress a section it should do as you ask it. Again it works correctly for all other export formats - it fails in CSV files only.

0 Kudos

Hi,

I'll try the group selection option to replace the conditional suppression on the section as that may work in some cases. However, sometimes we need to suppress the details section based on some criteria that is determined by what is in the records that preceded the detail line we want to suppress. We can't put this into the reocrd selection criteria because you can't have a selection criteria for a record based on the contents of other records. Section criteria for a record is based on the data in THAT record. This becomes particularly problematic if you are using shared variables.

We are often generating CSV files to be used as interface files to third party systems. We run these as automatic scheduled tasks once a day or once a week etc. The way we have had to do conditional suppression for CSV files in the past is to create one field which is defined as

Field1 &"," & Field2 & "," & Field3 & "," & Field4 & "," & Field5

then we output that one field instead of the original field list.

If we still export to a CSV file we no longer get a row of commas for the suppressed row - we just get a blank line (which is better but still not good as often the integration interfaces we have to export to state that blank lines in the CSV file are not acceptable). So we export as a TEXT file which then suppresses what we are asking to suppress - no blank lines. The file extension is TXT instead of CSV but at least the contents of the file are now a valid CSV file with no lines of commas and no blank lines.

We have one report with 150 columns where we have had to do this. VERY frustrating.

The thing is this is not (or should not be) a "by design" matter. It is a flaw. If you want to suppress the data fields and export a line of commas instead then you would put the conditional suppression on the fields themseves. If you put the conditional suppression on the whole section then that is clearly what you want to happen.

The final point is that all of the other export formats suppress the whole section if that's what you've asked for - it is ONLY the CSV export that has this flaw.

DellSC
Active Contributor
0 Kudos

Also, there is an open request for this on the SAP Influence site. It's been there since 2017 with only a couple of votes. You can go to https://influence.sap.com/sap/ino/#/idea/203602/, log in, and vote for the idea to help increase the possibility that it will be considered for implementation.

-Dell

ido_millet
Active Contributor
0 Kudos

Apply the suppress condition (in reverse) to the Group Selection formula.
the Group Selection formula allows you to include logic involving summaries.