table.IMPORT_ASCII_TABLE Function

Syntax

Record_Count as C = Table.Import_Ascii_Table(C ascii_filename [,N skip_lines [,L silent ]])

Arguments

Record_Count

The number of records processed, imported and not imported (because they violated a field rule in the target table). The format of the result string is:

Record_CountProcessed:xxx
Total:xxx
Violated:xxx
ascii_filename

The name of the file to import.

skip_lines

Optional. Default = 0. Indicates how many rows to skip in the file being imported. If the file that you are importing has field names in row 1, then you would set Skip_Lines to 1.

silent

Optional. Default = .T.

.T. = Alpha Anywhere does not display a confirmation message.
.F. = Alpha Anywhere does display a confirmation message after the data is imported.

Description

Imports a fixed length ascii file into an existing table. Ascii file must match the structure of the table. If ascii file has fieldnames, set skip_lines to 1

Discussion

The .IMPORT_ASCII_TABLE() method imports a CR-LF delimited ASCII file directly into a table. The ASCII data must exactly mach the format of the table. For example, assume that the table that you want to import data into has this structure:

Customer,C,20
City,C,1 5
State,C,2

The ASCII file must have "Customer" data starting in column 1, "City" data starting in column 21, and "State" data starting in column 36.

Example 

The following Xbasic snippet shows how this method can be used to import data contained in a file called "c:\tabledata.txt" into a table called "customers":

Dim tbl as P
Tbl = table.open("customers")
Tbl.Import_Ascii_Table("c:\tabledata.txt",1,.f.)
Tbl.close()

See Also