[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: conversion from xy to dbf



AndyCh wrote:
I have a long xy file,
1) 1=item1 2=item2 3=item3
2) 1=item1 2=item2 3=item3
............................................

is there a good way to export all data to a dbf file ?

Thanks.
Sure. First, let's use accurate terminology: 1), 2), and so on are records; item1, item2, and so on are fields. End each record with a CR/LF. Put a tab character between each field within a record. If there are spaces or punctuation marks within any fields, enclose all instances of that field in quotation marks (standard ASCII ones, not smart quotes). Carefully note the maximum length of each field and the type of content (e.g., if any have numbers, dates, logical values, etc.). Open your database app and create a table with as many fields as you have in your XY file per record (that is, if each record has 3 fields, create a database table with 3 fields). Define their types to match those of the Xy file; e.g., any field enclosed in quotes is of type CHARACTER; any with a number is of type NUMERIC; any with a date is of type DATE. Define their lengths to that of the longest one (e.g., let's say field 3 is 12 characters long in record 1, 10 characters long in record 2, and 25 characters long in record 15; you make it a 25-character-long field of type CHARACTER in your database). Once you have the table defined, use the database's import text file function, specifying that the file is TAB delimited.
Or you could do this, if you have a decent spreadsheet program. Set up
the fields and records in Xy. Define the lot (or do it in chunks if OOM
looms or it looks as if you will go over Clip's limits), use U2's Clip
function to copy to the Windows clipboard, then paste into a blank
spreadsheet. Once you have everything in the spreadsheet, you can tweak
anything that might have gotten misaligned, then SAve AS a dbf file. I
jsut tried that with a very short file, pasting to Lotus 1-2-3, and it
worked fine. Spreadsheets tend to more readily recognize tab-delimited
files than modern databases do. Good luck and don't hesitate to ask if
more advice is needed. As I said a while back, Xy and database is a
marriange made in heaven (and database is what computers are all about;
everything else is lagniappe.)

Patricia M. Godfrey
PriscaMG@xxxxxxxx