Need help serializing duplicate records

Ask a Question related to FileMaker, Design and Development.

  1. #1

    Default Need help serializing duplicate records

    Hi everyone...hope you can help!

    We have a single database containing contact info for individuals and
    their companies. There are about 8000 records total, with about half of
    those records containing duplicated company info.

    In other words, contact John Smith works for ABC Company and so does
    Sally Jones. There are two records with different contact info but the
    same company info.

    I need to (1) locate the duplicate records and (2) assign each unique
    company with a serial number (company_id). Then I want to (3) split out
    all of the contacts and relate them back by the company_id. The
    contacts have already been serialized with a contact_id.

    Essentially we want to make the database company driven rather than
    individual driven.

    I am drawing a complete blank on how to accomplish this. Any
    suggestions would be REALLY helpful to get me going.

    Scott
    [email]scottcoatsNOSPAM@nasfm.org[/email]


    Please remove the anti-spam stuff from my email if replying.

    Scott Guest

  2. Similar Questions and Discussions

    1. Duplicate records
      Hi I don't know if this is the best way to query for duplicate records but this works. If someone has a better idea to do this please feel free to...
    2. Return Records and not duplicate them :: Again
      I will finish the post this time... I need help on the following situation. I have a solution in ASP/VB Script where I query a RecordSet for...
    3. select all the duplicate records
      Hi, My table in the database may contain duplicate records, which means except the primary key (auto_increment) field is unique, all or almost of...
    4. Deleting duplicate records
      Jon, You didnt supply the DDL, so I can only point to existing practices to remove duplicate records.Here they are: INF: How to Remove...
    5. Duplicate records?
      Hi Shai Use field validation to ensure that entries are unique, with a custom message to tell the user what to do if they aren't. Bridget Eley...
  3. #2

    Default Re: Need help serializing duplicate records

    Hi Scott

    Please, PLEASE back up your database before you test this.

    Both scripts assumes that company names have been entered correctly and
    consistently and that they are unique. If company names are misspelled,
    they will be treated as new companies. You can minimise this risk in future
    by formatting this field as a pop-up list that references the field itself.
    If a company already exists, it should be selected from the list rather than
    entered manually. If two companies have the same name, they will be treated
    as one company. If this is going to be an issue for you, you may need to
    find all the records that fall into this category manually, create another
    field into which to enter something that would make the company name unique
    then concatenate the two fields in a calc field then substitute the calc
    field for the company field in both scripts.

    The first script is only meant to be used once - as soon as the existing
    records are processed, delete it and begin using the second script below to
    enter Company No in new records.

    Update existing records:

    Show All Records
    Sort [ Sort Order: Company (Ascending) ] [ Restore sort order, No dialog ]
    Go to Record/Request/Page [ First ]
    Set Field [ Current Company No, 1 ]
    Set Field [ Current Company, Company ]
    Loop
    If [ Company = Current Company ]
    Set Field [ Company No, Current Company No ]
    Else
    Set Field [ Current Company, Company ]
    Set Field [ Current Company No, Current Company No + 1 ]
    Set Field [ Company No, Current Company No ]
    End If
    Go to Record/Request/Page [ Next, Exit after last ]
    End Loop

    (where Current Company is a global text field and Current Company No is a
    global number field)

    Enter Company No for new records:

    If [IsEmpty(Company No)]
    Exit Record/Request
    If [ Count(Company::Company) = 1 ]
    Set Field [ Company No, Max(Constant::Company No) + 1 ]
    Else
    Set Field [ Company No, Company::Company No ]
    End If
    Else
    Beep
    End If

    (where the constant self join rel is based on calc field = 1 on both sides
    and where company self join rel is based on company field on both sides)

    Take the Company No field out of the tab order, format it to be
    non-enterable and as a button that runs this script.

    Bridget Eley


    in article 290720031652021375%noone@nowhere.com, Scott at [email]noone@nowhere.com[/email]
    wrote on 30/7/03 6:52 AM:
    > Hi everyone...hope you can help!
    >
    > We have a single database containing contact info for individuals and
    > their companies. There are about 8000 records total, with about half of
    > those records containing duplicated company info.
    >
    > In other words, contact John Smith works for ABC Company and so does
    > Sally Jones. There are two records with different contact info but the
    > same company info.
    >
    > I need to (1) locate the duplicate records and (2) assign each unique
    > company with a serial number (company_id). Then I want to (3) split out
    > all of the contacts and relate them back by the company_id. The
    > contacts have already been serialized with a contact_id.
    >
    > Essentially we want to make the database company driven rather than
    > individual driven.
    >
    > I am drawing a complete blank on how to accomplish this. Any
    > suggestions would be REALLY helpful to get me going.
    >
    > Scott
    > [email]scottcoatsNOSPAM@nasfm.org[/email]
    >
    >
    > Please remove the anti-spam stuff from my email if replying.
    >
    Bridget Eley Guest

  4. #3

    Default Re: Need help serializing duplicate records

    Hi Bridget,

    First, thanks for your elegant and thoughful reply. You wrote it in
    such a way that even a FM neophyte like myself could understand it.

    The first script went perfectly. I haven't implemented the second, but
    it looks like the right solution.

    Please post you contact info if you do contract work. The folks I'm
    helping may have paid opportunities in the future.

    Thanks again,

    Scott


    In article <BB4D3EB6.2324%bridgeteley@ihug.com.au>, Bridget Eley
    <bridgeteley@ihug.com.au> wrote:
    > Hi Scott
    >
    > Please, PLEASE back up your database before you test this.
    >
    > Both scripts assumes that company names have been entered correctly and
    > consistently and that they are unique. If company names are misspelled,
    > they will be treated as new companies. You can minimise this risk in future
    > by formatting this field as a pop-up list that references the field itself.
    > If a company already exists, it should be selected from the list rather than
    > entered manually. If two companies have the same name, they will be treated
    > as one company. If this is going to be an issue for you, you may need to
    > find all the records that fall into this category manually, create another
    > field into which to enter something that would make the company name unique
    > then concatenate the two fields in a calc field then substitute the calc
    > field for the company field in both scripts.
    >
    > The first script is only meant to be used once - as soon as the existing
    > records are processed, delete it and begin using the second script below to
    > enter Company No in new records.
    >
    > Update existing records:
    >
    > Show All Records
    > Sort [ Sort Order: Company (Ascending) ] [ Restore sort order, No dialog ]
    > Go to Record/Request/Page [ First ]
    > Set Field [ Current Company No, 1 ]
    > Set Field [ Current Company, Company ]
    > Loop
    > If [ Company = Current Company ]
    > Set Field [ Company No, Current Company No ]
    > Else
    > Set Field [ Current Company, Company ]
    > Set Field [ Current Company No, Current Company No + 1 ]
    > Set Field [ Company No, Current Company No ]
    > End If
    > Go to Record/Request/Page [ Next, Exit after last ]
    > End Loop
    >
    > (where Current Company is a global text field and Current Company No is a
    > global number field)
    >
    > Enter Company No for new records:
    >
    > If [IsEmpty(Company No)]
    > Exit Record/Request
    > If [ Count(Company::Company) = 1 ]
    > Set Field [ Company No, Max(Constant::Company No) + 1 ]
    > Else
    > Set Field [ Company No, Company::Company No ]
    > End If
    > Else
    > Beep
    > End If
    >
    > (where the constant self join rel is based on calc field = 1 on both sides
    > and where company self join rel is based on company field on both sides)
    >
    > Take the Company No field out of the tab order, format it to be
    > non-enterable and as a button that runs this script.
    >
    > Bridget Eley
    >
    >
    > in article 290720031652021375%noone@nowhere.com, Scott at [email]noone@nowhere.com[/email]
    > wrote on 30/7/03 6:52 AM:
    >
    > > Hi everyone...hope you can help!
    > >
    > > We have a single database containing contact info for individuals and
    > > their companies. There are about 8000 records total, with about half of
    > > those records containing duplicated company info.
    > >
    > > In other words, contact John Smith works for ABC Company and so does
    > > Sally Jones. There are two records with different contact info but the
    > > same company info.
    > >
    > > I need to (1) locate the duplicate records and (2) assign each unique
    > > company with a serial number (company_id). Then I want to (3) split out
    > > all of the contacts and relate them back by the company_id. The
    > > contacts have already been serialized with a contact_id.
    > >
    > > Essentially we want to make the database company driven rather than
    > > individual driven.
    > >
    > > I am drawing a complete blank on how to accomplish this. Any
    > > suggestions would be REALLY helpful to get me going.
    > >
    > > Scott
    > > [email]scottcoatsNOSPAM@nasfm.org[/email]
    > >
    > >
    > > Please remove the anti-spam stuff from my email if replying.
    > >
    >
    Scott Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139