2

I am passing this XML:

<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
    <soap:Body>
        <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>
            <listName>BookPages</listName>
            <query>
                <Query xmlns=''>
                    <OrderBy>
                        <FieldRef Name='ows_Book_x0020_Number' />
                    </OrderBy>
                </Query>
            </query>
            <viewFields>
                <ViewFields xmlns=''>
                    <FieldRef Name='Book_x0020_Number' />
                </ViewFields>
            </viewFields>
            <queryOptions>
                <QueryOptions xmlns='' />
            </queryOptions>
        </GetListItems>
    </soap:Body>
</soap:Envelope>

All that I want are the distinct Book_x0020_Number values. Is there any way to do this?

UPDATE:

I am calling the web service using jQuery. Any solution would have to be using jQuery or a feature of the web service itself.

2
  • As far as I know that is not possible in the XML alone. Is this from client side code or .Net code? I am just wondering what context it is being used in. Commented Apr 21, 2011 at 17:34
  • This is on the client side. I am using jQuery. Commented Apr 21, 2011 at 17:36

3 Answers 3

3

It is not possible to get distinct values directly from the GetListItems web service.

Since this is on the client side, you will need to get the full list of results and then get the distinct values using JavaScript + jQuery.

1
  • This is what I ended up doing. Commented Apr 21, 2011 at 18:12
4

Have you ever used SPServices? This will allow you to do these calls without writing the soap stuff yourself. I use it and if for example I am populating a dropdown, I will sort the return and iterate using the jQuery each option and then check to see if it is unique by testing it against the last option in the iteration.

2
2

Answer from StackOverflow

https://stackoverflow.com/questions/560550/what-is-the-best-way-to-retrieve-distinct-unique-values-using-spquery

1
  • Unfortunately using a DataView is not an option. Commented Apr 21, 2011 at 17:42

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.