Well, the first thing I notice is that your for/next counter, SPECIALPART, isn't used anywhere... Using LOCATE will search for the PART.NBR in the whole SPECIAL.PARTS field, so the for/next isn't needed.
Next, I notice that this assignment: SPECIAL.FROM.QTY=SPECIAL.REC<14,SPECIAL> is duplicated, once just before the IF and once just after the THEN. One of them can probably be dropped. Hope this helps some.... Jeff Fitzgerald Fitzgerald & Long, Inc. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Tuesday, March 16, 2004 3:18 PM To: [EMAIL PROTECTED] Subject: Looking for associated multi-value algorithm... I'm looking for an algorithm for searching through a group of associated multi-value fields. The fields are F12 (PartsList), F14 (From Qty) and F16 (Unit Price). I can't depend on these being in any certain order, just that the associated fields will be in identical order. What I want to return is the Unit Price (F16) given PART.NBR and QTY.REQUESTED. I've got a code snippet of what I think will work, but I'd like to get some feedback on it...it won't work because, there's a better way of doing this, etc. Thanks. SPECIAL.PARTS = SPECIAL.REC<12> SPECIALCOUNT = DCOUNT(SPECIAL.PARTS,VM) SPECIAL.FROM.QTY.TEMP = 0 FOR SPECIALPART = 1 TO SPECIALCOUNT LOCATE PART.NBR IN SPECIAL.PARTS<1,STARTPOS> SETTING SPECIAL ELSE EXIT SPECIAL.FROM.QTY=SPECIAL.REC<14,SPECIAL> IF SPECIAL.FROM.QTY<QTY.REQUESTED AND SPECIAL.FROM.QTY>=SPECIAL.FROM.QTY.TEMP THEN SPECIAL.FROM.QTY = SPECIAL.REC<14,SPECIAL> SPECIAL.PART.PRICE = SPECIAL.REC<16,SPECIAL> TEMP.OUT = OCONV(SPECIAL.PART.PRICE,MDP) "R#12" SPECIAL.FROM.QTY.TEMP = SPECIAL.FROM.QTY END STARTPOS = SPECIAL + 1 FIRST = 0 NEXT SPECIALPART DATA.OUT=TEMP.OUT RETURN -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
-- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
