Home → Using LincDoc 3.1+ → Configuring Storage Repositories → SQL Repository: Mapping Multiple Fields to a Single Column
Important: This topic contains advanced user material. If you need further assistance, or are unsure about how to proceed, contact LincDoc Technical Support.
It is possible to map multiple fields to the same column in a table. This action requires writing multiple rows in the table per document. To complete this task, a multi-mapping key column needs to be added to the table. This column should not be confused with the id system column. Multiple distinct values are set for the multiple rows written to the database, and each field mapped to another column in the table corresponds to one of the distinct values.
Note: It is also possible to write multiple rows in the table per multi-row table record.
In order to better understand this topic, it is important that you understand the example that is being used.
In this example, suppose a Document Package collects a residence's address and a mailing address with the following fields and associated values:
Using this information, a table can be created with the following columns:
The type column is the multi-mapping key column, and its values are residence and mailing. Using the type column as a filter, a single lookup can be created to retrieve either the physical address or the mailing address. Normally, two separate lookups would be needed. In addition, if more address types are added (such as home, office, etc.), the structure can support them without the need for even more lookups.
The address1, address2, city, state, and zip fields are mapped to the appropriate database columns that correspond to the residence value of the type column.
The mail_address1, mail_address2, mail_city, mail_state, and mail_zip fields are mapped to the appropriate database columns that correspond to the mail value of the type column.
The full table, including specified values, would appear as follows:
id |
version |
group_name |
row_index |
type |
address1 |
address2 |
city |
state |
zip |
1 |
1 |
-1 |
residence |
123 Main St. |
Apartment 4B |
Springfield |
NY |
12345 |
|
1 |
1 |
-1 |
|
PO Box 7 |
East Springfield |
NY |
12346 |
Search index fields should be mapped corresponding to only the first three multi-mapping key column values in the first table.
For example, if you have residence, mailing, work, and alternate as your four address types, the search will only use the residence, mailing, and work address types. The fourth type (alternate) will not be used in the search.
If you are using multiple mapping, you should contact your local database administrator for assistance. Although LincDoc attempts to make this configuration easy to understand, without the proper knowledge you can easily corrupt your database.
In order to use multiple mappings, you first need to activate the general settings. Once that is done, you need to specify the multi-mapping key column for each table in your repository.