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

Reply via email to