6

I'm following the steps in this article to setup a joined data view webpart joined on a lookup field:

http://deannaschneider.wordpress.com/2011/11/11/joined-subviews-with-linked-datasources-in-sharepoint-2010/

To summarize these steps, I need to expose the ID column as an additional field in the lookup:

enter image description here

(image copied from linked blog post above)


I'm creating my lists and lookup columns declaratively inside a Visual Studio solution, and I would like to add this additional field in the xml. How do I do this?

The xml definition for my lookup field is as follows:

<Field ID="{5D184D01-082C-4831-8757-CA2C98F05221}"  
       Name="EventInquiry"  
       DisplayName="Event Inquiry"  
       Type="Lookup"  
       Required="FALSE"  
       Group="Ops Inquiry Tracking Columns"  
       ShowField="EventCode"  
       List="Lists/Event Inquirys"></Field>

2 Answers 2

13

To setup the additional field from the lookup, you need to add a second lookup field pointing at the same list, but include the FieldRef attribute on the second lookup field. The value of this attribute should be the same as the ID attribute of the first lookup field.

<Field ID="{393F697A-7F99-488E-B67F-41DFD6D41857}" 
       FieldRef="{5D184D01-082C-4831-8757-CA2C98F05221}"  
       Name="EventInquiryID"  
       DisplayName="Event Inquiry:ID"  
       Type="Lookup"  
       Required="FALSE"  
       ShowField="ID"  
       List="Lists/Event Inquirys"></Field>
-1

For me the example provided on http://sharpointpractice.blogspot.nl/2011/08/sharepoint-field-types-elementsxml.html worked to get the second field from the lookup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.