I'm trying to get a list count based on the CAML query below, but it keeps returning zero. It should return the number of projects assigned to a designer (person or group type column) which their project status is NOT complete. Any ideas what might have wrong in my code.
Here are some excerpts of my code:
<!-- SPSERVICE QUERY BLOCK-->
<script>
$(document).ready(function(){
$(".showResultsOpenProjs").click(function(){
var selectedDesignerOpenProjs = $("#selectedDesignerOpenProjs").val(); alert(selectedDesignerOpenProjs);
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Marketing Requests",
CAMLRowLimit: 5000,
CAMLQuery: "<Query><Where><And><Eq><FieldRef Name='Assign_x0020_To'/><Value Type='User' >" + selectedDesignerOpenProjs + "</Value></Eq><And><Neq><FieldRef Name='Status'/><Value Type='Text' >COMPLETED</Value></Neq><Neq><FieldRef Name='Status'/><Value Type='Text' >CANCELLED</Value></Neq></And></And></Where></Query>",
completefunc: function(xData, Status)
{
var dataLengthOpenProjs = $(xData.responseXML).SPFilterNode("z:row").length;
$(".resultsDivOpenProjs").html("Designer: <b>" + selectedDesignerOpenProjs + " </b><br>Projects in this date range: <br><h1><b>" + dataLengthOpenProjs + "</b></h1>");
$(".resultsDiv2").empty();
$(xData.responseXML).SPFilterNode("z:row").each(function()
{
var jobIDOpenProjs = parseInt($(this).attr("ows_ID"));
console.log($(this).attr("ows_Title"));
$(".resultsDiv2").append("Project Title: <b>" + jobIDOpenProjs + " - <a href='https://dschs.sharepoint.com/SchoolDevelopment/StudentOutreach/Lists/Marketing%20Requests/Item/displayifs.aspx?List=f13e5db4-080c-4be2-92e9-7df0b7cdd852&ID=" + jobIDOpenProjs + "' target='_blank'>"+$(this).attr("ows_Title")+"</a></b><br>");
});
/************Debugging********
alert(Status);
var out = $().SPServices.SPDebugXMLHttpResult({
node: xData.responseXML
});
$("#debug").html("").append("<b>This is the output from the GetList operation:</b>" + out);
/******************************/
}
});
})
});
</script>
Assign To
field a person type field? What's an example value forselectedDesignerOpenProjs
?<And>
tags aren't nested properly, plus you have<And></And>
towards the end of your query string that doesn't make any sense.