Trying to write an import script
Nancy Palmquist
nlp at vss3.com
Mon Mar 8 11:00:08 PST 2004
Keith Hamilton wrote:
>
> Hi Guys,
>
> Im trying to write an import script to update selected fields and
> records in a filePro file. I have everything written but I cant seem to
> figure out how to have a variable for a field name. The problem is on line
> 14 where I try to have it update a field number with a variable. Please let
> me know if this can be done or not.
>
> -- Keith
>
> @menu þ If: exists("import/customerimport") le "0"
> þ
> Then: end
> þ
dim fields(42):1 'where 42 is the number of fields in your file.
> 2 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: TL(255, ASCII); TI(255, ASCII); TC(2, *); NB(50, *); TD(3, .0);
> þ
> 3 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: TF = open("import/customerimport", "rt")
> þ
> 4 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: NB = readline(TF, TL)
> þ
> 5 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: TI = mid(TL, 1, instr(TL, "~"))
> þ
> 6 ------- - - - - - - - - - - - - - - - -
> þ If: not TI eq "1"
> þ
> Then: end
> þ
> 7 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: lookup cust = EXCUST K=TI i=A -NX; NC(1, .0) = "0"
> þ
> 8 ------- - - - - - - - - - - - - - - - -
> þ If: not cust
> þ
> Then: end
> þ
> 9 ------- - - - - - - - - - - - - - - - -
> loopf þ If:
> þ
> Then: NB = readline(TF, TL)
> þ
> 10 ------- - - - - - - - - - - - - - - - -
> þ If: NB le "0"
> þ
> Then: goto closeup
> þ
> 11 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: TC = instr(TL, "~")
> þ
> 12 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: TD = int(mid(TL, 1, TC)); TC = TC + "1"
> þ
> 13 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: TC = mid(TL, TC, len(TL))
> þ
> 14 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: cust(TD) = TC;
change this line to :
fields(td) = tc
> þ
> 15 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: goto loopf
> þ
> 16 ------- - - - - - - - - - - - - - - - -
> closeupþ If:
> þ
> Then: write cust
> þ
> 17 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: close cust
> þ
> 18 ------- - - - - - - - - - - - - - - - -
> þ If:
> þ
> Then: end
> þ
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
--
Nancy Palmquist
Virtual Software Systems
PHONE: (412) 835-9417 Web site: http://www.vss3.com
More information about the Filepro-list
mailing list