M
Mark Davies
Guest
Hi, Hoping that I understood your question - check if the following makes sense: I created two temp-tables (ttTable & ttTableB) where I created two records for Customer 1 but one with a different DocumentNumber. I then created a record in ttTableB that is the same as the first record in ttTableA. Using the BUFFER-COMPARE statement I compared the fields in each of the tables while iterating through ttTableA and if there is a different in the DocumentNumber I export the data to your work folder in a file called TableAExport.d and then delete the record in ttTableA. Finally I loop through table ttTableA and ttTableB to show the remaining records. /*********************************************************************************************************/ DEFINE VARIABLE cDifferences AS CHARACTER NO-UNDO. DEFINE TEMP-TABLE ttTableA NO-UNDO FIELD CustomerNumber AS INTEGER FIELD CustomerName AS CHARACTER FIELD DocumentNumber AS CHARACTER. DEFINE TEMP-TABLE ttTableB NO-UNDO FIELD CustomerNumber AS INTEGER FIELD CustomerName AS CHARACTER FIELD DocumentNumber AS CHARACTER. CREATE ttTableA. ASSIGN ttTableA.CustomerNumber = 1 ttTableA.CustomerName = "Customer 1" ttTableA.DocumentNumber = "DocumentNo". CREATE ttTableA. ASSIGN ttTableA.CustomerNumber = 1 ttTableA.CustomerName = "Customer 1" ttTableA.DocumentNumber = "DocumentOther". CREATE ttTableB. ASSIGN ttTableB.CustomerNumber = 1 ttTableB.CustomerName = "Customer 1" ttTableB.DocumentNumber = "DocumentNo". FOR EACH ttTableA: FIND FIRST ttTableB WHERE ttTableB.CustomerNumber = ttTableA.CustomerNumber NO-ERROR. IF AVAILABLE ttTableB THEN DO: BUFFER-COMPARE ttTableA TO ttTableB SAVE RESULT IN cDifferences. IF cDifferences <> "" AND LOOKUP("DocumentNumber",cDifferences) > 0 THEN DO: OUTPUT TO VALUE(SESSION:TEMP-DIRECTORY + "TableAExport.d"). EXPORT ttTableA. OUTPUT CLOSE. DELETE ttTableA. END. END. END. FOR EACH ttTableA: DISPLAY ttTableA WITH FRAME fTableA DOWN. END. FOR EACH ttTableB: DISPLAY ttTableB WITH FRAME fTableB DOWN. END. /*********************************************************************************************************/
Continue reading...
Continue reading...