EXPORT_CSV
|
Syntax: |
EXPORT_CSV(<Name
of Index File>,<Number of Key>,<Name of CSV File>,<Column
Headers>,<Field Numbers>,<Separator>,<Date
Format>,<Apostrophe> [,<Macroname>])
|
||||||||||||||||||
|
|
|
||||||||||||||||||
|
Meaning: |
EXPORT_CSV exports data records from the Index File <Name of Index
File> into a CSV file. <Number of Key> specifies the number of the key (0 = Primary key,
1,... = Secondary key) by which the Index File is read. First, a START
or STARTS is executed in the Index
File with the key = <Number of Key>. Before EXPORT_CSV is called, the
appropriate values for the first data record to be exported have ro be
assigned to the key fields. All Following data records of the Index File are
read with READ-NEXT or READS-NEXT. <Number of Key> can be
a variable or a numeric expression. If <Number of Key> < 0, the Index File is not read by START / START and READ-NEXT / READS-NEXT,
but by GET_FIRST_RECORD and GET_NEXT_RECORD. This
increases speed. But in this case all data records of the Index File
are exported. If <Number of Key> >= 0, the export starts at the current data record of the Index
File which is specified by the selected key. If <Number of Key> > 0 and the key does not exist, EXPORT_CSV returns the result -5. <Name of CSV File> contains the name of the CSV file into which
the data records are exported. <Column Headers> contains the column headers, which are written
into the first line of the CSV file. The headers are separated by
<Separator>. If <Column Headers> is the empty string ²², the field names
are used as column headers. If <Column Headers> consists of blanks only
(one or several blanks), no heading is written into the CSV file. <Field Numbers> contains the numbers of the fields that are to
be exported. The numbers are separated by semi-colons. If <Field
Numbers> is the empty string ²², all fields of the Index
File are exported. <Separator> specifies the separator in the CSV file. If
<Separator> is the empty string ²², the separator
is a semi-colon ; . <Date Format> specifies the format in which date fields are to
be exported. (e.g. MM.DD.YYYY or YYYY.MM.DD). If <Date Format> is the
empty string ²², the records are exported in the format
YYYYMMDD. If <Apostrophe> <> 0, the data fields are put into
inverted commas ²...². If a <Macroname> is specified, the macro is executed before the
current data record is exported. If EBUS_DATA = 0 in the macro, the
current data record is not exported and the next data record is processed.
If EBUS_DATA
= ,
the current data record is not exported and the processing is finished.
EXPORT_CSV
returns the following results:
|
||||||||||||||||||
|
Parameter: |
|
||||||||||||||||||
|
Sample: |
// Export all data records of all Index
Files FOR I%=1 TO EBUS_FILENAME_SIZE
FILE$ = LOWER$(NOBLANK$(1,EBUS_FILENAME$(I%)))
INITIALIZE FILE$
H% = EXPORT_CSV(FILE$,0,DATEI$+".csv","","",CHR$(9),"MM-DD-YYYY",0)
IF H% <>
1
THEN ERRORMES = "Error " + STR$(H%) + " with file " +
FILE$ + ": " + ERRORTEXT$
ENDIF ENDLOOP |
||||||||||||||||||
|
See also: |
|