Question

Here is the list (please note 'Full Name' column has been changed to 'FullName' since I took this shot: enter image description here

Here is the CAMLQuery:

$(document).ready(function() {

    var camlQuery = "<View><Query><Where><Eq><FieldRef Name='ows_Branch' /><Value 
    Type='Choice'>Headquarters Support (MEAD)</Value></Eq></Where></Query></View>";  

    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "{E9E9983E-FECC-49DC-BA8D-4D0AE236C3C1}",
        CAMLQuery: camlQuery,
        CAMLViewFields: "<ViewFields><FieldRef Name='FullName' /></ViewFields>",
        completefunc: function (xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function() {
                var liHtml = "<span>" + $(this).attr("ows_FullName") + "</span>";
                $("#HSMEAD").append(liHtml);
            });
        }
    });
});

I just need to pull the full name from each branch and division and append it to a div. The caml query is not working but if i comment that out, the CAMLViewFields works fine and renders ALL the names from 'FullName' into the div correctly.

If there is a way to do it with JS without the query I am interested.

UPDATE:

with @Marko Tica's help, here is a final query that works for me:

  $(document).ready(function() {
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "{E9E9983E-FECC-49DC-BA8D-4D0AE236C3C1}",
    CAMLQuery: "<Query><Where><Eq><FieldRef Name='Column6' /><Value 
    Type='Choice'>Headquarters Support (MEAD)</Value></Eq></Where></Query>",
    CAMLViewFields: "<ViewFields>  <FieldRef Name='FullName' /> 
    </ViewFields>",
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
         
       var liHtml = "<span>" + $(this).attr("ows_FullName") + "</span>";
           $("#HSMEAD").append(liHtml);

         });
       }
     });
    });
   </script>
Était-ce utile?
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top