|
Fewyn Wanderer
Joined: 27 Sep 2002 Posts: 83
|
Posted: Thu Aug 19, 2010 5:17 pm
Removing Duplicates from Variable List? |
I've searched through the help for awhile and can't quite find anything that might be of any use. I currently have a rather large variable that has a list of a large number of people from certain guilds on Discworld. The problem is every time I execute the command to add people to the list it duplicates people who are already in it. Is there any easy way to run through the list and purge the duplicates?
Here's an example of one of the variables:
http://fewyn.pastebin.com/Ld4wdQ5i
As you can see there are a lot of duplicates :(
Any help would be appreciated! |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Aug 19, 2010 5:44 pm |
I believe you are looking for the %dups function. That should do the trick.
|
|
_________________ Asati di tempari! |
|
|
|
Fewyn Wanderer
Joined: 27 Sep 2002 Posts: 83
|
Posted: Thu Aug 19, 2010 5:52 pm |
Sadly it removes all the duplicates and I need to keep at least one :(
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Aug 19, 2010 6:03 pm |
Are you sure. It should keep one of each.
Try this for example.
Code: |
#SHOW %dups(Athos|Bertrand|Caesar|Bertrand|Caesar|Bertrand) |
I'll also try your specific variable.
[Edit]I just did a test with your variable and it works as expected. Only instance of each name remains (I randomly checked a couple). Which one is in the original list but not the de-duped list?
Here is my test code
Code: |
#SHOW %countlist(%dups(%sort(@DupTest)))
#show %countlist(%sort(@DupTest)) |
Note that DupTest is a variable containing your list. |
|
_________________ Asati di tempari!
Last edited by Tech on Thu Aug 19, 2010 6:11 pm; edited 1 time in total |
|
|
|
Fewyn Wanderer
Joined: 27 Sep 2002 Posts: 83
|
Posted: Thu Aug 19, 2010 6:11 pm |
Nevermind I'm a moron and setup the alias wrong :s Thanks Tech!
|
|
|
|
|
|