Oh yeah, sure. I agree. Using LOCATE or FOR/NEXT is my preferred method, but the <-1> does come in handy in some cases, and actually was the main point of the original posting (see bottom in case you weren't following this thread)
I recently had to keep datasets aligned coming in from two different sources, one sub-multivalue, the other just multivalued, so they had to have separate FOR/NEXT LOCATE routines with the SMV loop nested in the MV loops subroutine. Oh, yeah, this was *fun*...heh...(mvBASE code) The output is eventually to be used to adjust inventory at the LOT/PART level if shipping does not match allocation. BUILD.PART.LOT.ARRAY: * * Build array of SHIPPED LOTS/PARTS and their quantities from incoming *SMV* format SVM.COUNT = DCOUNT(ORD.REC<116,J>,@SM) FOR PL.I = 1 TO SVM.COUNT LINE.SHP = SHIP<1,J,PL.I> PART.LOT = ORD.REC<116,J,PL.I>:'*':ORD.REC<117,J,PL.I> LOCATE PART.LOT IN BOTH.PARTLOTS SETTING LP.INDEX THEN SHIPPED.QTYS<LP.INDEX> += LINE.SHP END ELSE BOTH.PARTLOTS = INSERT(BOTH.PARTLOTS, LP.INDEX, 1, 1, PART.LOT) SHIPPED.QTYS = INSERT(SHIPPED.QTYS, LP.INDEX, 1, 1, LINE.SHP) ORDERED.QTYS = INSERT(ORDERED.QTYS, LP.INDEX, 1, 1, 0) END NEXT PL.I * * Build array of ORDERED LOTS/PARTS and their quantities IF ORD.REC<11,J> > "" THEN ; *If Ordered part number exists THEN PART.LOT = PART.NBR:'*':LOT.NBR LOCATE PART.LOT IN BOTH.PARTLOTS SETTING LP.INDEX THEN IF BOTH.PARTLOTS<LP.INDEX> = PART.LOT THEN ORDERED.QTYS<LP.INDEX> += LINE.ORD END ELSE BOTH.PARTLOTS = INSERT(BOTH.PARTLOTS, LP.INDEX, 1, 1, PART.LOT) SHIPPED.QTYS = INSERT(SHIPPED.QTYS, LP.INDEX, 1, 1, '0') ORDERED.QTYS = INSERT(ORDERED.QTYS, LP.INDEX, 1, 1, LINE.ORD) END END ELSE BOTH.PARTLOTS = INSERT(BOTH.PARTLOTS, LP.INDEX, 1, 1, PART.LOT) SHIPPED.QTYS = INSERT(SHIPPED.QTYS, LP.INDEX, 1, 1, '0') ORDERED.QTYS = INSERT(ORDERED.QTYS, LP.INDEX, 1, 1, LINE.ORD) END END RETURN -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Kevin King Sent: Tuesday, May 23, 2006 10:09 To: u2-users@listserver.u2ug.org Subject: RE: [U2] Changed BASIC varname<1,-1> If you want them to stay in sync, keep a pointer variable and update each multivalue in tandem using the variable (which points to the mv position) rather than use -1. Personally, I think -1 is fine if there's only one array; if there are multiple to keep in tandem -1 is a yellow flag, fraught with all sorts of impending data corruption. -Kevin [EMAIL PROTECTED] http://www.PrecisOnline.com -----Original Message----- <snip> >Previously, code of A<1,-1> = B, when B was blank made no change to A. ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/