Script for finding duplicate accounts and identifying dups

Phil Davis revdev at pdslabs.net
Thu Nov 19 19:29:37 EST 2015


Hi John,

Here is yet another approach:

-- this button script assumes the list is in fld "list"
-- a somewhat brute force approach - focus is on results, not efficiency

on mouseUp

     -- organize all records into array
     put fld "list" into tUserList
     repeat for each line tLine in tUserList
         put item 2 of tLine & CR after tResultsA[item 1 of tLine]
     end repeat

     -- eliminate all records except dupes
     repeat for each key tKey in tResultsA
         if the number of lines in tResultsA[tKey] > 1 then -- dupes here
             repeat for each line tLine in tResultsA[tKey]
                 put tKey & tab & tLine & CR after tDupeList
             end repeat
             put CR after tDupeList
         end if
     end repeat

     put tDupeList
end mouseUp

Best -
Phil Davis



On 11/19/15 12:48 PM, JOHN PATTEN wrote:
> Thanks Mike and Craig,
>
> My issues was figuring out how to identify the item (username) in my list when I create and check via the array. I wasn’t sure about what that would look like, i.e.  "if tDataArray[item 1 of tLine] is empty then…”
>
> With 8000 + user accounts, there is a very good chance that we could have multiple “ggarcia” or “msmith" account duplicates. Mike solution allows me to pick out the account by unique id and configure them appropriately.
>
> Thanks Again!
>
>
>> On Nov 19, 2015, at 12:42 PM, Mike Bonner <bonnmike at gmail.com> wrote:
>>
>> I thought about the sort and compare method, and it works well if theres
>> only 2 that match, more lines of code are needed if there can be multiple
>> dupes.  But the single time through sort method is probably faster than the
>> array method I posted even after tweaking it to allow for multiple dupes.
>>
>> On Thu, Nov 19, 2015 at 1:27 PM, <dunbarx at aol.com> wrote:
>>
>>> Hi.
>>>
>>>
>>> I did not read Bernd's response. Are the records on separate lines?
>>>
>>>
>>> jdoe, 123456
>>> ggarcia, 121212
>>> ggarcia, 131313
>>>
>>>
>>> If they are not. make then so. And then, why not sort the list, and in a
>>> "repeat with..."  loop check each line with the line following. If they
>>> match, extract the two indexes. This should take only six lines of code.
>>>
>>>
>>> Craig Newman
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: JOHN PATTEN <johnpatten at me.com>
>>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>>> Sent: Thu, Nov 19, 2015 3:14 pm
>>> Subject: Script for finding duplicate accounts and identifying dups
>>>
>>> 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, 123456ggarcia, 121212ggarcia, 131313I’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,
>>> 121212ggarcia, 131313Thanks in advance for any ideas!John
>>> PattenSUSD_______________________________________________use-livecode
>>> mailing listuse-livecode at lists.runrev.comPlease visit this url to
>>> subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> _______________________________________________
>>> 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
>>>
>> _______________________________________________
>> 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
>
> _______________________________________________
> 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

-- 
Phil Davis





More information about the use-livecode mailing list