Append From TXT--> DBF Copy DBF--> TXT 
Author Message
 Append From TXT--> DBF Copy DBF--> TXT

Hello

did anyone can help me with

 1. save a dbase file to txt file
 2. load from txt file to dbase file

  thanks alot roni



Wed, 18 Jun 1902 08:00:00 GMT
 Append From TXT--> DBF Copy DBF--> TXT

Quote:

>Hello

>did anyone can help me with

> 1. save a dbase file to txt file
> 2. load from txt file to dbase file

It's easy to write, here's how.

Use a TBatchMove to import the data.

Create one TTable that uses the TableType "ttASCII" and points to the
original data file, one TTable that points to the new table and a
TBatchMove with the Mode set to batCopy. You will also need to create
what's called a schema file with the same name as the original data file but
with the extension *.sch. Here's how you create it (this is from the BDE
help file under the section "Binding external schema to text tables")

        -- Kirk

"Binding external schema to text tables"
Although you can set the field descriptors on text tables for use with
export/import utilities, the BDE text driver can bind an external schema
information to text tables. You bind schema information to a text table by
storing the schema information of that text table in another text file.
The extension of the text file containing the schema information will be
"sch". Thus, the name of the text file containing the schema information of
the text table zzz.txt will be zzz.sch. If the text table has an extension
other than "txt", extension of the schema file would still be "sch".

Schema File

All information in the schema file is case-insensitive.
Here is a sample schema file:

[CUSTOMER]     // File name with no extension.
FILETYPE = VARYING   // Format: VARYING or FIXED
CHARSET = ascii  // Language driver name.
DELIMITER = "         // Delimiter for char fields.
SEPARATOR = ,        // Separator character
Field1 = Name,CHAR,12,0,0 // Field information
Field2 = Salary,FLOAT,8,2,12

The schema file has a format similar to Windows INI files. The file begins
with the name of the table in brackets. The second line specifies the file
format following the keyword FILETYPE: FIXED or VARYING.

FIXED format file
Each field always takes up a fixed number of characters in the file, and the
data is padded with blanks as needed.
VARYING format file
Each field takes a variable number of characters, each character field is
enclosed by DELIMITER characters, and the fields are separated by a
SEPARATOR character. The DELIMITER and SEPARATOR must be specified for a
VARYING format file, but not for a FIXED format file.

The CHARSET attribute specifies the name of the language driver to use. This
is the base filename of the .LD file used for localization purposes.
The remaining lines specify the attributes of the table's fields (columns).
Each line must begin with "Fieldx = ", where x is the field number (that is.
Field1, Field2, and so on).
Next appears a comma-delimited list specifying:

Field name. Same restrictions as Paradox field names.
Data type. The field data type. See below.
Number of characters or units. Must be <= 20 for numeric data types. Total
maximum number of characters for date/time data types (including / and :
separators).
Number of digits after the decimal (FLOAT only).
Offset. Number of characters from the beginning of the line that the field
begins. Used for FIXED format only.

The following data types are supported:

CHAR      - Character
FLOAT     - 64-bit floating point
NUMBER    - 16-bit integer
BOOL      - Boolean (T or F)
LONGINT   - 32-bit long integer
DBIDATE   - Date field. Format specified in Registry
TIME      - Time field. Format specified in Registry
TIMESTAMP - Date/Time field. Format specified in Registry

Note: You specify date and time formats by using the BDE Administrator.

Example 1:  VARYING format file

CUSTOMER.SCH:

[CUSTOMER]
Filetype=VARYING
Delimiter="
Separator=,
CharSet=ascii
Field1=Customer No,Float,20,04,00
Field2=Name,Char,30,00,20
Field3=Phone,Char,15,00,145
Field4=First Contact,Date,11,00,160

CUSTOMER.TXT:
1221.0000,"Kauai Dive Shoppe","808-555-0269",04/03/1994
1231.0000,"Unisco","809-555-3915",02/28/1994
1351.0000,"Sight Diver","357-6-876708",04/12/1994
1354.0000,"Cayman Divers World Unlimited","809-555-8576",04/17/1994
1356.0000,"Tom Sawyer Diving Centre","809-555-7281",04/20/1994



Wed, 18 Jun 1902 08:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. txt --> dbf

2. DBF->ODBC->Oracle: ORA-02041

3. DBF&FPT->ODBC->Oracle: ORA-28500

4. Not a DBF file - save.txt [01/01]

5. Dumping txt files into dbf question (FPW2.6)

6. txt to dbf

7. Using DTS for exporting Data from .TXT to .DBF

8. NCH2DBF: NCH to TXT/DBF news import utility

9. .DBF file to .TXT????

10. txt to dbf

11. Converting a non SDF TXT file to a DBF


 
Powered by phpBB® Forum Software