Consultor Eletrônico



Kbase P20989: Can an unquoted comma embedded data fields be exported to a
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/18/2003
Status: Unverified

GOAL:

How to export unquoted comma embedded data fields to a CSV file without having resulting in more fields in the output CSV file?

FIX:

By definition, a Comma-Separated-Values (CSV) file is set of fields in text format where each field is followed by a comma. The fields may or may not be quoted.

There is no way to export an unqoted field containing a comma to a CSV file without having that field interpreted as two fields while reading that CSV file.
A possible workaround is to replace the embedded commas with some other character like a blank CHR(32):

DEFINE VARIABLE c AS CHARACTER NO-UNDO INITIAL ",a,a,a,a,".
MESSAGE "~"" REPLACE (c, ",", CHR(32)) "~""
VIEW-AS ALERT-BOX INFO BUTTONS OK.