Importing Text, Excel style - bumped
Alex Tweedly
alex at tweedly.net
Wed May 17 13:00:03 EDT 2006
mfstuart at cox.net wrote:
>Hi all,
>
>*** Any other takers on this? There must be something out there that simulates this feature. ***
>
>========================================================
>I have a columnar formatted text file that I'd like to "import" into a SQL
>database, using RunRev on WinXP.
>
>I'd like the RunRev program to have features similar to Excel's Text Import
>Wizard:
>
>- open file dialog
>- raw display of first 100 or so lines of chosen text file
>- allow user to define the column breaks
>- based on users column breaks, read text file and put into a table
> field for final approval to import into database
>- read into SQL table
>
>I've managed to develop the first two steps in the wizard, but I need help
>with the third and fourth steps.
>
>Especially the part where the user defines the distinction of column
>placements - Excel's "set field widths (column breaks)".
>
>That is, how to handle the placement and movement of the vertical line for
>column breaks.
>
>
I'm not at all familiar with Excel's import wizard (and don't have a
copy of Excel). Is there anything similar in Open Office ? I don't see a
likely candidate, but then I'm not sure what I'm looking for :-)
I'm *assuming* that this only allows you to defined fixed number of
characters in each field (e.g. old-fashioned punched card style).
I would take a look at the AltFldHeader plug-in from Altuit - see
http://www.altuit.com/webs/altuit2/altPluginCover/About.htm
and then follow the "Downloads" link to get details of the plug-ins they
have available. I think this, combined with a fixed-width font, would
allow your users to set the column widths as they want - and then some
simple arithmetic to convert from pixel-widths back to character widths
should give you number of characters per field.
Then a simple loop like
repeat for each line L in theFileData
repeat with i = 1 to numColumns
put char start[i] to end[i] of L into field[i]
end repeat
end repeat
SQL is outside my scope :-)
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.6/340 - Release Date: 15/05/2006
More information about the use-livecode
mailing list