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 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.

share|improve this question
    
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. –  spevilgenius Apr 21 '11 at 17:34
    
This is on the client side. I am using jQuery. –  Abe Miessler Apr 21 '11 at 17:36

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
    
This is what I ended up doing. –  Abe Miessler Apr 21 '11 at 18:12

Answer from StackOverflow

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

share|improve this answer
    
Unfortunately using a DataView is not an option. –  Abe Miessler Apr 21 '11 at 17:42

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.

share|improve this answer
    
I haven't but it looks very cool. I'll give it a look –  Abe Miessler Apr 21 '11 at 17:59
    

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.