|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Linking fields
Hello all,
I am updating a database table through an XML file. This XML file is populated via 3rd party app that I do not have access to. Part of the table includes a persons name. In some cases, the same name is entered multiple times but with different spellings such as: John Doe J. Doe John D. J. A. Doe JA Doe etc... Because I have no control over how the names are initially entered into the database, I cannot prevent this from happening. Additionally, I cannot manually change these entries because in some reports that are generated, the name needs to be exactly as it was in the XML file. However, the need has arisen to click on a name and return all references to that name. Using the case above, if I were to click on John Doe, then I would like to get results for each of the cases listed above. Therefore, I am working on creating an application to allow users to create links from one name to another. This must be done manually because I have cases where I have J. Doe and B. Doe that are two different names. My first thought was to create a new database table to handle these links. Each unique name has a corresponding id so I can simply save the name id's in a table with the following structure: int name_a int name_b For consistency, I can store the smaller id in name_a. As you can see however, linking n items will yield (n * (n - 1)) / 2 entries into the table. Even though this is polynomial, I have to think there is a better way to do this. Is there a better approach to solving this problem that I have not seen yet? |
|
#2
|
|||
|
|||
|
Right, you definitely don't want to store every pair of linked names. What you want is to associate to each name an identifier such that linked names receive the same identifier. For each identifier, you then have a set of names associated to it, and to retrieve all the entries for an input name, you look up its identifier in your auxiliary database, and for each name associated to that identifier, return the corresponding entries.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Software Design > Linking fields |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|