Hi,

Please check the below code that would remove duplicate value from the
array. The logic goes like this -

'1) Read CSV and put the values in a 2D array..

'2) Take non duplicate values from the 2D array and put it in another array

Dim arrWithDuplicates(7,1), arrWithoutDuplicates(7,1), iCounter, isDuplicate
iCounter = 0 : isDuplicate = False

arrWithDuplicates(0, 0) = "12345" : arrWithDuplicates(0, 1) = "Rahul"
arrWithDuplicates(1, 0) = "12346" : arrWithDuplicates(1, 1) = "Kiran"
'..........
'..........

'Add first value to the non duplicate array
arrWithoutDuplicates(0, 0) = arrWithDuplicates(0, 0)
arrWithoutDuplicates(0, 1) = arrWithDuplicates(0, 1)
iCounter = 1

'Check for Duplicate Values... Only add non duplicate ones to the new array
For i = 1 to 7

  isDuplicate = False

  'Loop through arrWithoutDuplicates array
  For j=0 to iCounter - 1
    If arrWithDuplicates(i, 0) = arrWithoutDuplicates(j, 0) Then
      isDuplicate = True
    End If
  Next

  'Add non duplicate values to the new array
  If isDuplicate = False Then
    arrWithoutDuplicates(iCounter, 0) = arrWithDuplicates(i, 0)
    arrWithoutDuplicates(iCounter, 1) = arrWithDuplicates(i, 1)
   iCounter = iCounter + 1
  End If

Next

'Display the Non Duplicate Values
For k=0 to iCounter - 1
  msgbox arrWithoutDuplicates(k, 0) & " " & arrWithoutDuplicates(k, 1)
Next



*Cheers,
 a n i s h

[My QTP Blog] <http://www.automationrepository.com/>

[Get New Posts in your
Inbox]<http://feedburner.google.com/fb/a/mailverify?uri=automationrepository/feeds>
*

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to