Syntax:
GATEWAY EXPORT CSV filename.csv +
SELECT clause +
OPTION COL_NAMES value +
|QUALIFIER symbol +
|SEPARATOR symbol +
|REC_SEP value +
|SHOW_PROGRESS value +
|MESSAGES value +
|ACTION value +
|BLANK_IF_NULL value +
|BLANK_IF_ZERO value +
|MERGE_DATA value +
|ESCAPE_QUOTES value +
|SPECIFICATION_FILE_NAME filename +
|DATASET_FIELD_ORDER value +
|NO_UNICODE_CONVERSION value +
|ADD_UTF8_BOM value
filename.csv
This parameter defines the file name of the target file with exported data using the Comma Separated Values format. The file extension must be csv.
SELECT clause
Use the SELECT command to identify rows of data from a table or view.
OPTION
ACTION
Defines the default action which will be processed after export is complete, for example, to open the target export file in view/edit mode or send this exported file by email as attachment. Available Parameter: OPENVIEW
ADD_UTF8_BOM
Specifies whether to add a UTF8 BOM to an exported UTF8 string. Available Parameters: ON / OFF
BLANK_IF_NULL
If ON, will export NULL values as blank values. If OFF, will export NULL values as the database NULL setting. The default is set to OFF. Available Parameters: ON / OFF
BLANK_IF_ZERO
If ON, will export zero values as blank values. If OFF, will export zero values as zero. The default is set to OFF. Available Parameters: ON / OFF
COL_NAMES
If ON, will add a first row with column names. If OFF, will only export data. Available Parameters: ON / OFF
DATASET_FIELD_ORDER
Specifies the export will follow the SELECT clause column order, rather than the field order in the specification file, when a specification file is used as an OPTION parameter. The default is set to OFF. Available Parameters: ON / OFF
ESCAPE_QUOTES
Specifies if R:BASE exports data and adds an additional double quote character (") if data is encountered where a double quotes exists. The two double quotes allow for greater data compatibility with other program input processes. The default is set to ON. If ESCAPE_QUOTES is set to OFF, double quote characters are exported as is. Available Parameters: ON / OFF
MESSAGES
If ON, during export process some messages will be displayed such as -ERROR- messages, if any. If OFF, the entire export process will be in "silent" mode. Available Parameters: ON / OFF
MERGE_DATA
If ON, the exported data will be added to the specified file, if exists. The default is set to OFF. Available Parameters: ON / OFF
NO_UNICODE_CONVERSION
Exports Unicode data as a UTF8 string to fit in the target field, ensuring no data is lost. If OFF, the Unicode data will be converted to ANSI and characters from source that is higher than 0x127 will become ‘?’. As not all target formats support Unicode and this field is for cases when source is Unicode and destination is normal text field. Available Parameters: ON / OFF
QUALIFIER
Changing the value of this option you can define any qualifier for fields in the target Comma Separated Values text file. The popular value is Quotes (") but you can define any custom character you wish. Use the keyword PIPE as the value if you wish to use the pipe character as the qualifier. Use the keyword NONE if you wish to specify no text qualifier.
REC_SEP
Defines the separator between lines in the target text file. The popular value is CRLF (#13#10) or CR(#13) but you can define any other custom string. Available Parameters: CR / LF / CRLF
SEPARATOR
Defines the separator of fields in target text file. The popular values are Semicolon (;), Comma (,), Space (#32) but you can define any other character if you wish. If the pipe character is needed to be specified as the separator, then use the keyword PIPE as the value.
SHOW_PROGRESS
Indicates whether to display status dialog during export process. Set SHOW_PROGRESS to ON if you wish to show an animated status dialog during the export process. Set SHOW_PROGRESS to OFF if you wish to export data without animated status dialog. Available Parameters: ON / OFF
SPECIFICATION_FILE_NAME
This parameter is used to load a prepared specification with all pre-defined settings for exporting. The export must be performed once using the graphic user interface "Export Wizard" and saved using the "Specifications.." button. The specifications will be stored in a file with the .RGW file extension. The .RGW file acts as a set of default values. Any value in the .RGW file will be overwritten by the same parameter specifically assigned by an OPTION parameter. Since the input file name is required in the GATEWAY command, the input file name in the .RGW will always be overwritten.
Examples:
GATEWAY EXPORT CSV D:\TEMP\Employee.CSV +
SELECT * FROM Employee WHERE EmpStatus = 'Active' +
OPTION COL_NAMES ON +
|QUALIFIER " |SEPARATOR , |REC_SEP CRLF +
|SHOW_PROGRESS ON |ACTION OPENVIEW
GATEWAY EXPORT CSV G:\Durgin.CSV +
SELECT * FROM QuoteTable +
OPTION COL_NAME ON|SEPARATOR PIPE
GATEWAY EXPORT CSV D:\DataStore\Contacts.CSV +
SELECT * FROM Contacts +
OPTION BLANK_IF_ZERO ON|MESSAGES OFF