Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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>
share|improve this question

2 Answers 2

up vote 1 down vote accepted

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>
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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