AnsweredAssumed Answered

Help with loop logic, find duplicates

Question asked by jlarmen on Aug 4, 2014
Latest reply on Aug 5, 2014 by philmodjunk

Title

Help with loop logic, find duplicates

Post


     I have an import from a CSV with a product number and ID. I need to find the duplicates within the found set, so say if the records look like this:

         
  1.           Product_id=465
  2.      
  3.           Product_id=465
  4.      
  5.           Product_id=465
  6.      
  7.           Product_id=500
  8.      
  9.           Product_id=500
  10.      
  11.           Product_id=500
  12.      
  13.           Product_id=500

     I need to find the duplicates, except the first one and mark the first incident so I can export those ID's as a csv. I thought about a 'duplicate' field, then a loop to check to see if the current record Product_ID matches the previous, if so-put an 'X' in the duplicate field. If not, move to next record and check again. Maybe I'm tired, but the logic is driving me nuts.

     I thought about something like this:

     Set Variable [$$dup; Value:Product::ID]
     Go to Recore/Request/Page [Next]
     If [Product::Duplicate <> "x"]
     Else If [Product::ID=$$dup]
         Insert Text[Select,Product::Duplicate; "x"]
     End If
     Go to Record/Request/Page[Next]

     But I'm sure this wrong and not working. Any ideas?
      

      

      

Outcomes