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

When I use SPServices to query a list it brings back some of the columns with odd prefixes and encoded characters.

How can I get rid of the Oddball characters? I recognize the @amp; as a HTML encoded character... but what's with this 5;#
**What is the pattern so I can filter it out?

See results from Chrome List.asmx request: ows_DocType='2;#P&ID' ows_Complex='5;#Complex' etc...

enter image description here

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

This is the standard format used by SharePoint to return lookup values. For example 5;#Complex means that the item ID is 5 and its Title is Complex.

The same format is also used for multiple lookups. The Web service will return a chain like this:

ID1;#Title1;ID2;#Title2;ID3;#Title3
share|improve this answer
    
Christophe Thanks! –  Ben_Coding Mar 28 '13 at 16:22
    
For the record you'll also see # in other column types like calculated columns. –  Christophe Mar 28 '13 at 16:24
add comment

All the columns that have number prefixes are lookup type columns.
When I look at the Data in JSON

<d:DocTypeId m:type="Edm.Int32">2</d:DocTypeId>

My guess is that SharePoint uses that as a reference. Since the actual value doesn't exist in that direct table is my guess. On my test site the odd prefixes don't show up.

enter image description here

References:

  1. see Microsoft Technet
  2. see Blog PeteStilgoe.com

Syntax is: “ID;#Value

share|improve this answer
add comment

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.