Getnext lookup -

Nancy Palmquist nlp at vss3.com
Thu Dec 4 08:53:36 PST 2008


Walter Vaughan wrote:
> Preface: I always thought using *clerk as import tool was evil
> Recently: Because of working with SQL so much recently I've changed
> 
> Senario: Import data from spreadsheet. Two columns, part number and price
> 
> @keyR::mesgbox "Replace with data from /tmp/2009changes.csv?","Press y 
> or n","yn":
> :@bk ne "y":end:
> loopU::import word upd=/tmp/2009changes.csv:
> :not upd:end:
> ::pn(10,,g)=upd(1):
> ::lookup -  k=pn   i=b -nx:
> :1 ne pn:show "@No match for "<pn; goto loopU:
> udprice::6=upd(2):
> ::write:
> ::getnext -:
> :1 ne pn:goto loopU:
> ::goto udprice:
> 
> I know this is not production level code, but since I've never
> until this morning used "getnext -", I thought I'd pass it on for
> someone else who might could use this snippet as an example.
> 
Walter,

That is interesting use of lookup dash.  I would just have done a lookup to a 
record and posted to the record.  The getnext - can trip you up if the record 
you are sitting on is the last record in the file.  Don't forget to test for
not - (dash)

I wonder why you would do a lookup by PN (part number I guess) with a match 
exactly and then getnext at all.  Could they have 2 records that match the same 
part number and why wouldn't the lookup find the match or indicate there was no 
match?  And if there are two records with the same part number, how do you know 
which one to fix?

Remember if 1="BigPart" and pn eq "BIG" it will find that part of no other part 
name starts with BIG.

And you test 1 ne pn would not catch that difference.

1{"~" ne pn{"~" would test true when they are identical and false when they are not.

Any silly character that is never in pn would work.

Nancy


-- 
Nancy Palmquist 		MOS & filePro Training Available
Virtual Software Systems	Web Based Training and Consulting	
PHONE: (412) 835-9417		   Web site:  http://www.vss3.com


More information about the Filepro-list mailing list