Script for finding duplicate accounts and identifying dups

Mike Bonner bonnmike at gmail.com
Thu Nov 19 15:38:51 EST 2015


I like arrays for this sort of thing.  I'm sure theres a more efficient way
to do it but here is code that might work ok.

on mouseUp
   put field 1 into tData -- the list
   repeat for each line tLine in tData
      if tDataArray[item 1 of tLine] is empty then -- build the array keyed
by username
         put item 2 of tLine into tDataArray[item 1 of tLine]
      else
         put comma & item 2 of tLine after tDataArray[item 1 of tLine] --
builds a list of userids for that username
      end if
   end repeat
   put the keys of tDataArray into tKeys
   repeat for each line tLine in tKeys
      if the number of items in tDataArray[tLine] > 1 then -- if theres
more than one userid its a dupe
         put tLine & comma & tDataArray[tLine] & cr after tDupes -- build
the output list
      end if
   end repeat
   delete the last char of tDupes
   put tDupes into field 2
end mouseUp



On Thu, Nov 19, 2015 at 1:12 PM, JOHN PATTEN <johnpatten at me.com> wrote:

> Hi All,
>
> I have a list of user accounts and unique IDs. The user accounts are first
> initial + last name. A typical list might look like the following:
>
> jdoe, 123456
> ggarcia, 121212
> ggarcia, 131313
>
> I’m trying identify the duplicates, list the username and their unique 6
> digit id.
>
> I have been using the following code that Bernd shared while ago:
> http://forums.livecode.com/viewtopic.php?f=9&t=6226#p28787 <
> http://forums.livecode.com/viewtopic.php?f=9&t=6226#p28787>
>
> …but it only works if i leave off my unique 6 digit IDs from my list of
> accounts, naturally.
>
> I would like to be able to identify the user accounts that are exact
> duplicates but then differentiate them by their unique 6 digit ID. So
> essentially, create a new list of just the duplicates and ids, i.e.
>
> ggarcia, 121212
> ggarcia, 131313
>
> Thanks in advance for any ideas!
>
> John Patten
> SUSD
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list