encsv(X;FD;RD;QC;O)
Converts a table or query value X
into CSV or
other delimiter-separated text. (Available as of version
19.77)
Description
Currently, encsv(X;FD;RD;QC;O)
must be called from the accum; typically,
in the scalar context in block code.
Syntax
encsv(X;FD;RD;QC;O)
Input
Argument | Type | Description |
---|---|---|
X |
The table or query value to be converted to CSV format. | |
FD |
text | The field delimiter in the CSV file. The default value is
',' . |
RD |
text | The row delimiter in the CSV file. The default value is
'\n' . |
QC |
text | The quote character in the CSV file. The default value is
'"' . |
O |
text |
A list of 0 or more special options:
|
Return Value
Returns a CSV or other delimiter-separated text. The functions throws an error if the data is too large. Currently, the limit is 1,00,000 total cells (calculated as number of rows x number of columns).
Cells in the header or the data that contain the field delimiter, row delimiter, or the
quote character itself will be quoted in the CSV-compliant manner, by surrounding them with
the quote character, and any occurrences of the quote character will be doubled in the
field. For example (assuming "
quote character), the string red,
"white," and blue
will appear as "red, ""white,"" and blue"
.
Note that formatted numbers containing commas will naturally be quoted if the field
delimiter is ','
. If the 'quoteall'
option is specified,
all fields will be quoted whether or not they contain the delimiter or quote character.