John:

Thanks for sharing this. I had not thought of this way after all these years. I 
will take the idea and apply where appropriate, in addition to my normal code 
to reduce duplicates.


Jody Bevan
ARGUS Productions Inc.
Developer

Argus Productions Inc. <https://www.facebook.com/ArgusProductions/>




> On Aug 7, 2017, at 11:50 AM, John Baughman via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> What I have done is to have a field in the table  that contains the keys that 
> make the record unique with all spaces, special characters, and vowels 
> removed, as well as eliminating any consecutive consonants . See my example 
> below. So far this has worked pretty well for me and I guess would fall under 
> David’s category of "Carefully program your system to detect and prevent 
> duplicate rows”
> 
> John
> 
> —————— Example ------------
> $firstName:=[Contacts]firstName (John)
> $lastName:=[Contacts]lastName (Baughman)
> $company:=[Contacts]company (BY’te DESIGN Hawwaii)  notice I have mistakenly 
> put more than 1 w in Hawaii.
> $DupeCheck:= $firstName+ $lastName+$company
> [Contacts]DupeCheck:=AlphaOnlyNoVowels ($DupeCheck;"*”)  //AlphaOnlyNoVowels 
> does the heavy lifting. The asterisk tells the method to remove consecutive 
> consonants.
> 
> [Contacts]DupeCheck now contains  “JHNBGHMNBYTDSGNHW”
> 
> I wrap the above in a duplicate checking method for the [Contacts] table 
> called ContactsDuplicateManager
> 
> Whenever a record is updated or created in the Contacts table…
> 
> $DupeCheck:= ContactsDuplicateManager ("isDuplcate”;[Contacts]ID)
> 
> The ContactsDuplicate method creates the check string as above and searches 
> the contacts table for duplicates using the [Contacts]DupeCheck field. If no 
> duplicates are found it returns the check string. If a duplicate is found it 
> returns the check string with a prepended asterisk.  The contact ID if passed 
> prevents the dupe check from finding the record being updated. If this is a 
> new record 0 is passed for the Contact ID. So…
> 
> If ($DupeCheck =“*@“
>   Handle the duplicate in context. If, for example this is a user updating or 
> creating a contact record, warn the user of the possible duplicate with 
> available options.
> 
> else
>   [Contacts]DupeCheck:=$DupeCheck
>   SAVE RECORD([Contacts)
> 
> end if
> 
> -------------------------------------
> 

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to