J
James Palmer
Guest
Is this expected behaviour? Consider the code below against sports2000. If the named buffers are scoped to the IP then the buffers are only in scope if they have been explicitly found in that iteration of the query. If not then the buffer is out of scope again. If on the other hand I move the definitions to the definitions of the .p then the records are in scope as necessary. BLOCK-LEVEL ON ERROR UNDO, THROW. DEFINE TEMP-TABLE tt-Test NO-UNDO FIELD custnum LIKE s2k.Customer.CustNum FIELD ordernum LIKE s2k.Order.Ordernum FIELD linenum LIKE s2k.OrderLine.Linenum INDEX idxbb IS PRIMARY custnum ordernum linenum. RUN PopulateTT. RUN DoBreakBy. PROCEDURE DoBreakBy: DEFINE BUFFER lb-Customer FOR s2k.Customer. DEFINE BUFFER lb-Order FOR s2k.Order. DEFINE BUFFER lb-OrderLine FOR s2k.OrderLine. FOR EACH tt-Test BREAK BY custnum BY ordernum BY linenum: IF FIRST-OF(tt-Test.custnum) THEN DO: FIND lb-Customer NO-LOCK WHERE lb-Customer.custnum EQ tt-Test.custnum NO-ERROR. END. IF FIRST-OF(tt-Test.ordernum) THEN DO: FIND lb-Order NO-LOCK WHERE lb-Order.Ordernum EQ tt-Test.Ordernum NO-ERROR. END. IF FIRST-OF(tt-Test.linenum) THEN DO: FIND lb-OrderLine NO-LOCK WHERE lb-OrderLine.OrderNum EQ tt-Test.Ordernum AND lb-OrderLine.linenum EQ tt-Test.linenum NO-ERROR. END. MESSAGE AVAIL lb-Customer SKIP AVAIL lb-Order SKIP AVAIL lb-OrderLine VIEW-AS ALERT-BOX. END. END PROCEDURE. PROCEDURE PopulateTT: FOR EACH s2k.OrderLine NO-LOCK, FIRST s2k.Order OF s2k.OrderLine NO-LOCK: CREATE tt-Test. ASSIGN tt-Test.custnum = s2k.Order.CustNum tt-Test.OrderNum = s2k.Order.OrderNum tt-Test.linenum = s2k.OrderLine.Linenum. END. END PROCEDURE.
Continue reading...
Continue reading...