Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Importing text files into tables
Message
From
17/08/2000 16:06:30
 
 
To
17/08/2000 14:54:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00406303
Message ID:
00406365
Views:
29
>I'm using a form to try to import a text file into an existing table without using a wizard. I can locate the file paths but cannot figure
>out how to merge text document into the table. The text file I'm using contains more data than I want to import.
>
>Q: how do I import a text file into that table and set positions so the correct data goes into specific columns?

Create a table that matches the structure of the data coming in, assigning foedls of the correct type and width for what you're reading, filling gaps with dummy fields (dummy1, dummy2, etc.) APPEND into the temporary table. Take the actual data table and append in the records from the temp table; fields will be matched on name, not size or position.


ie:

text file:

AAAAAABBBBB.BBCCCDDDDD

Live table: Afld C(10), Bfld Y, Dfld C(5)

CREATE CURSOR temp (afld C(6), Bfld N(8,2),dummy1 C(3), Dfld C(5)
APPEND FROM txtfile.txt TYPE SDF
SELECT 0
USE LiveTable
APPEND FROM (DBF('temp'))
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform