1. RE: EDS help

Kent Vogt wrote:

> --select table
>     if db_select_table("all") != DB_OK then
>         puts(2, "Couldn't find table!\n")
>         abort(1)
>     end if
> 
> --start loop of rewriting data--currently not a loop
> --trying to get it to work for the first item
> 
> item=db_record_data(1)

At this point, you need to print out what item is, just to verify it's 
holding what you expect. It seems from the error that item will be a one 
element sequence, and you expect it to be at least 11 elements long.

new topic     » topic index » view message » categorize

2. RE: EDS help

Okay, I'll take a stab....

> item=db_record_data(1)
> 
> ? item
> --I think the problem is here!
>     --reorganize data
>         upc=item[11..11]&item[13..17]&item[19..24]
>         code=item[25..31]
>         descrip=item[33..63]
>         dept=item[73..75]
> 
>     --replace data 
>         db_replace(1, {upc, code, descrip, dept})
> 
> --bottom of loop (eventually)
> db_dump
> --close database
> db_close

Maybe should be:


>         upc=item[1][11..11]&item[1][13..17]&item[1][19..24]
>         code=item[1][25..31]
>         descrip=item[1][33..63]
>         dept=item[1][73..75]

Because in your ex.err item is {{xxxxxx}} which means a sequence made up 
of one sequence.  So when you say item[11] that doesn't work because the 
top-most level of item only has a length of one.  You should be 
referencing item[1][11].

HTH,

Jonas

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu