none
Is it Possible to get distinct values from GetListItems?

    Question

  • I am Passing the XML for getting List item and binding to dropdown. Here i have shown the code..

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <title></title>
         <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js" type="text/javascript"></script>
     </head>
     <body>
     
        <select id="input2" style="width:30%"><option>Any</option></select>
     
        <script type="text/javascript" language="javascript">
             $(document).ready(function () {
                 var soapEnv =
      "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
      <soapenv:Body> \
      <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
      <listName>as</listName> \
      <viewFields> \
      <ViewFields> \
      <FieldRef Name='Team_x0020_name'/> \
      </ViewFields> \
      </viewFields> \
      </GetListItems> \
      </soapenv:Body> \
      </soapenv:Envelope>";
                 $.ajax({
                     url: "../_vti_bin/lists.asmx",
                     type: "POST",
                     dataType: "xml",
                     data: soapEnv,
                     complete: processResult,
                     contentType: "text/xml; charset=\"utf-8\""
                 });
             });
     
     
           var select = $('#input2');
     
             function processResult(xData, status) {
                 $(xData.responseXML).find("z\\:row").each(function () {
                     select.append("<option>" + $(this).attr("ows_Team_x0020_name") + "</option>");    
     
                });
     
          
            }
         </script>
    </body>
    </html>

    I need to get the distinct Values. Is it Possible or not from the above code?

    Please help.

    Thanks in advance.

    Tuesday, June 25, 2013 10:14 AM

Answers

All replies