Double Lookup to same SharePoint List

Mar 21, 2014 at 9:44 AM
At the moment we are testing SLAM for a SharePoint application and we have the situation, that we have two different lookup columns which are pointed to the the same list.
If I configure this in the slam.config file, I get an error when I activate it.

It is possible to sync two SharePoint lists to SQL Server, which have two or more lookup columns to the same list?
Developer
Mar 28, 2014 at 1:16 AM
This is certainly possible. Sorry for the delay, but if you still have the issue, what kind of error are you getting?
Mar 29, 2014 at 12:23 AM
When I try to add a lookup to the same list I get an error ULS when I start the table creation on SharePoint.
The error is
column names in each table must be unique. Column name 'TeilbereichID' in table 'Teilprojekt' is specified more than once
The xml configuration is
<Field Name="SubProjectSubDivision" SPType="Lookup" AssociatedTypeName="Teilbereich" Required="true"></Field>
<Field Name="SubProjectRecordOwner" SPType="Lookup" AssociatedTypeName="Teilbereich" Required="true"></Field>
Developer
Mar 29, 2014 at 3:08 AM
I misunderstood the situation from your first question, but now I understand. I was going to recommend you use the Column attribute, but I double checked the code and it doesn't look like Column is used in that situation. So at the moment you cannot have two foreign key columns in the same table. One solution though would be to add the "AssociationTableName" attribute to one or both of them to make separate association tables. For consistency you might want to do something like:
<Field Name="SubProjectSubDivision" SPType="Lookup" AssociatedTypeName="Teilbereich" AssociationTableName="TeilprojektSubProjectSubDivision" Required="true"></Field>
<Field Name="SubProjectRecordOwner" SPType="Lookup" AssociatedTypeName="Teilbereich" AssociationTableName="TeilprojektSubProjectRecordOwner" Required="true"></Field>
The resulting tables would both have columns TeilprojektID, TeilbereichID.