importing list

Jim Ault JimAultWins at yahoo.com
Thu Mar 9 11:45:26 EST 2006


On 3/9/06 1:03 AM, "Alex Tweedly" <alex at tweedly.net> wrote:

> Jim,  you can't do that (at least, not if I interpreted Liam's email
> correctly).  I'm pretty sure he is saying that the file contains
> multiple "entries", each entry consisting of the multiple "fields".  If
> you had a single entry, then this 'split'-based technique is the one I'd
> use - but it can't be used while there are multiple entries ....  you'd
> finish up with an array element for each field name, containing the data
> for the last entry.
> 
> You could keep the outer loop from Devin's code, to create tCurrRecord,
> and then split tCurrRecord

Yes, Alex, you are correct about the multiple 'records' per file, and I was
thinking that in the beginning, but was not sure since the description of
the task was not clear.  As you say, you would need to put another repeat
level to parse the multiple 'records' per file, then do the array stuff.

After assuming one-per-file, I offered the attached alternative.  I would
design a more robust approach by using regEx, assuming some errors, the
possibility multiple records per file, and even test for incomplete records,
missing values, as well as incomplete html downloads.

I have several programs that do very robust html download and error checking
for my business projects.  One program I use as a lynch pin is AltBrowser by
Altuit.

Glad you studied this well enough to see the limitations :-)

Jim Ault
Las Vegas





> Jim Ault wrote:
> 
>> ---------------
>> Another approach would have an advantage or two.
>> ONE - using a web address like http://website.com would not use the colon as
>> a delimiter, since the 'split' command only considers the first occurance
>> TWO - if any glitches occurred that added spurious lines that did not match
>> an existing field, these would be ignored. (eg. tab, space)
>> THREE - if your labels have a leading/trailing space this will get cleaned
>> off
>> FOUR -- filter rawData without empty
>> 
>> NOTE: I would recommend that you not use "/" in your field label (eg.
>> Principal/Director)  can lead to problems later with scripting.
>> 
>> -------------------------------------------------------------





More information about the Use-livecode mailing list