Navigation:  Classes > bArrayServer >

bArrayServer:CopyToFile()

Print this Topic    Previous pageReturn to chapter overviewNext page

Purpose

Copy records into a file.

Class

bArrayServer

Type

Method

Syntax

<oArrayServer>:CopyToFile(

<oDBFTarget> | <oFSTarget> | <cTarget>,

[<aiField> | <acField> | <asymField> | <aoDFField>],

[<uForCondition>],

[<uWhileCondition>],

[<uScope>]

[<symFormat>],

[<cDelimiter>],

[<symTextFormat>],

[<cDriver>],

[<acRDD>]

) Æ lSuccess

Arguments

<oDBFTarget>An object of class DBServer. The records are copied into the DBServer. The DBServer must be open. The argument is supported only if for the argument <symFormat> the value #DBF is specified.
Data Type:DBServer

 

<oFSTarget>A file path as FileSpec. The target file is created to this path. An existing file is overwritten.
Data Type:FileSpec

 

<cTarget>A file path as string. The target file is created to this path. An existing file is overwritten.
Data Type:String

 

<aiField>An array of field numbers. The values of these fields are copied into the target file. If omitted, all fields of the ArrayServer are used as default.
Data Type:Array

 

<acField>An array of field names as string. The values of these fields are copied into the target file. If omitted, all fields of the ArrayServer are used as default.
Data Type:Array

 

<asymField>An array of field names as symbol. The values of these fields are copied into the target file. If omitted, all fields of the ArrayServer are used as default.
Data Type:Array

 

<aoDFField>An array of DataField objects. The values of these fields are copied into the target file. If omitted, all fields of the ArrayServer are used as default.
Data Type:Array

 

<uForCondition>A condition evaluated for each record in the scope. Only records at which the evaluation of the condition returns the result TRUE are copied into the target file.
Data Type:String | Codeblock | _Codeblock

 

<uWhileCondition>A condition evaluated for each record from the current record until the condition returns FALSE.
Data Type:String | Codeblock | _Codeblock

 

<uScope>Define the range of records to process. The values below are supported:

 

Value

Description

DBSCOPEALL

The scope is all the records in the bArrayServer. This is the default.

DBSCOPEREST

The scope is the remaining records in the bArrayServer from the current position.

<iRecords>

The scope is the next <iRecords> records.

 

Data Type:Logic | Integer

 

<symFormat>Defines the format of the target file. The values below are supported:

 

Value

Description

#DBF

DBase file (DBF):

The format of the database can be defined with the arguments <cDriver> and <acRDD.

#SDF

Text file:

The records in the text file are separated with CRLF. The field values within the records always have the same length.

#Delimited

Text file:

The records in the text file are separated with CRLF. The field values within a record are separated with the character which was defined in the argument <cDelimiter>.

 

Data Type:Symbol

 

<cDelimiter>A single character which is inserted as a delimiter between the fields of a record into the text file. The argument is supported only if for the argument <symFormat> the value #Delimited is specified. The character "," is used as default.
Data Type:String

 

<symTextFormat>Defines the format, in which field values of the data type STRING are copied into the target file. The values below are supported:

 

Value

Description

#None

Texts are copied without quotation marks into the target file.

#Double

Texts are copied with double quotation marks " into the target file.

#Simple

Texts are copied with simple quotation marks ' into the target file.

 

The argument is supported only if for the argument <symFormat> the value #Delimited is specified. The value #None is used as default.

Data Type:Symbol

 

<cDriver>The name of the RDD which is used for the DBF file. If not specified, the default RDD as determined by RDDSetDefault() is used. The argument is supported only if for the argument <symFormat> the value #DBF is specified.
Data Type:String

 

<acRDD>An array with the names of RDD which are used for the DBF file in addition to the main RDD. If omitted, no additional RDD are used. The argument is supported only if for the argument <symFormat> the value #DBF is specified.
Data Type:Array

Return Value

lSuccessA logical value indicates whether the records could be copied into the target file.
TRUEThe records were copied.
FALSEThe records could not be copied.
Data Type:Logic

Description

bArrayServer:CopyToFile() copies all or single records from the ArrayServer into a target file. If the target file already exists, then it is overwritten. The directory path for the file must already exist. It is not created automatically.

 

If in the argument 2 no fields are specified, then all fields of the ArrayServer are copied into the target file.

 

When creating the target file only fields which are of the data type "C", "D", "L" or "N" are used. In addion for a DBF file the data type "M" is still used. Fields of other data types are ignored.

 

Note!
After copying the record pointer is unchanged.

See Also

bArrayServer:CopyDB()

bArrayServer:CopyDelimited()

bArrayServer:CopySDF()

bArrayServer:CopyStructure()

 


Page url: http://www.YOURSERVER.com/index.html?barrayserver_copytofile.htm