Jump to content

Need help with finding duplicates


Recommended Posts

I created 12 inputs on the left and on the right (comes a total of 24 inputs). On the left inputs; user are not allow to type the same text (User suppose to type their Name. If it's already exist - ex: John, they would need to type John 2), but on the right side, user can (It stores their computer assettag). Is there a better way to store all the string from the right side inputs onto array and if it finds duplicate string; it would delete it and use the same assettag?

 

Ex:

 

Inputs on left | Inputs on right
John | Tag#1234
John2 | Tag#2134
John3 | Tag#4321
James | Tag#1234
James2 | Tag#2134
James3 | Tag#5678
James4 | Tag#8765
Jammie | Tag#4321
Jammie2 | Tag#5678
Jammie3 | Tag#0123
Jammie4 | Tag#9999
Joseph | Tag#8888
So when eliminating duplicates and store onto array, it should be:
Inputs on Right
Tag#1234
Tag#2134
Tag#4321
Tag#5678
Tag#8765
Tag#0123
Tag#9999
Tag#8888

I could then use those array to write onto file. The file would rename to the first person who have the assettag before the second person. So for example: James 2 is the second person who has the assettag of 1234; I would not name the file James2. I would name it to John instead. I could do it the hard way, but was looking to do it with array which I think it might be more efficient or if you know a better way. Let me know. My hard ways involve using the if statement and because the if statement only compare 1 comparison once only; i have to create another function to check for another duplicates.

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

fantastic... I got it to display what I wanted to see with your suggestion... Now the million dollar question :) how do I write the code to write to files?

Because it would need to know how many unique array that aren't duplicates.

 

$aArrayUnique[0] would return the amount of unique array. I know that would be useful, but just not sure how I would go above that.

 

EDIT: testing out do until. Unfortunately I found out that $aArrayUnique does not spit out both column from $aArray[12][2]. The end result when removing duplicates, it only display 1 column.

Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...