Sharepoint 2010: Lookup columns in Data Views using SOAP & REST webservices

By peter.stilgoe









If you are using a webservice & a dataview to display list data across sites in Sharepoint 2010 you may come across this problem when displaying lookup columns.

A lookup field is stored in the format “ID;#Text”

When using a REST data connection the values returned for the lookup column is just the ID part of that item in the lookup list ie. “01″, I couldnt find a way how to return the text part of the lookup.

If you use a SOAP data connection it will retun the whole string ie, “01;#Blue”, so now we are getting the value but we dont want to display the the ID part or the ‘;#’ part. This is easily done changing the XSLT from

<xsl:value-of select="@ows_Colour_x0020_Status"/>

to

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

Now in your dataview instead of displaying “01;#Blue”, you will just be displaying the text value “Blue”.




Share

Leggi tutto

Using a lookup to return data from a list on a different site

By peter.stilgoe









At first glance this doesnt look possible OOTB but it is, just not very obvious!

The way to achieve this is to:

1) Create a list at say Site Collection level which contains a column with the data in you want to use on another site.

2) Now create a Lookup column at Site Collection Level which is pointing to the data from the above list that you want to use.

3) Now you can add that column, to any list, on any site, throughout the site collection.

Share

Leggi tutto