3

I see this difference when I'm working with lists in Data View Web Parts and manipulating the values in XSL. Why do some Lookup column values look like '1;#text' and others just have the text? I've never been able to figure that out.

It may have something to do with the Site Definition, but I'm just guessing. I've seen this difference in both SharePoint 2007 and 2010.

Right now I'm working in 2007, with lookups to Title columns in other lists. In this case, I don't have the ID;#. It seems to be consistent within installations.

Generally speaking, I would always prefer to see the ID;#, as I can then do much more reliable matching in my AggregateDataSources than if I have to use the text values.

4

Use this:

<xsl:value-of select="substring-after(@Manufacturer.,'#')"/>

instead of

<xsl:value-of select="Manufacturer."/>

for the look up column

1

From what I've read about LookUp columns and DVWP, in DVWP (and only in DVWP) LookUp columns get returned as a link to the column and the actual value (rather than the delimited value).

The data stored in the SPListItem still has the delimited value internally. It is not however surfaced in the DVWP.

It's just an illusion that the data is not stored as such.

See:

Inserting Lookup columns into Data View Web part displays as XML

http://codeforfuture.com/2011/03/15/how-to-remove-link-for-sharepoint-lookup-column-from-a-dataview-webpart-using-xslt/

http://jeevansd.blogspot.com/2012/03/removing-link-from-lookup-column-in.html

  • I added yet more info above. I'd really like to always see the ID;#. – Marc D Anderson Jul 31 '12 at 14:59
  • But that's not how the DVWP works. The data is stored internally like you want it, but the DVWP renders it like you're seeing it. It's a behavior of the DVWP not the SPListItem. – RJ Cuthbertson Jul 31 '12 at 15:00
  • Your question is "Why is it like this?" This is the answer. – RJ Cuthbertson Jul 31 '12 at 15:01
  • I think you're answering a different question than I'm asking. I'm writing my own XSL in the DVWP, not just clicking on buttons in the ribbon. In some environments I see the ID;# in lookup column values and in others I don't. I'm wondering why there;s a difference. – Marc D Anderson Jul 31 '12 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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