Skip to main content
added 234 characters in body
Source Link
Justin
  • 1.4k
  • 7
  • 27
  • 52

Ienter code hereI am using an example I found on codeplex of SPServices with CamlQuery to try to get list item values with where clause on the ID. For whatever reason this doesn't seem to work for me; please help!

function getToolInfo(lastID) {

    var CamlQuery = "<Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>" + lastID + "</Value></Eq></Where></Query>";
    var CamlViewFields = "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Title' /></ViewFields>";

  // this let me know that the function is getting called and passed the correct parameter value
  alert('function called and passed last ID of : ' + lastID);
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "FirstList",
    CAMLViewFields: CamlViewFields,
    CAMLQuery: CamlQuery,
      completefunc: function (xData, Status) {
        $(xData.responseXML).find("[nodeName='z:row']").each(function() {
        
        // just load a new variable with the returned value        
        var thisID = $(this).attr("ows_ID");
        alert(thisID);
        
      });
    }
  });
}

did I miss something obvious here? basically all the alerts are working except for the last.

Additionally if I remove this line:

$(xData.responseXML).find("[nodeName='z:row']").each(function() {

then i can add alert that works. I have double, triple, etc checked the list item with that ID and it is there.

I am using an example I found on codeplex of SPServices with CamlQuery to try to get list item values with where clause on the ID. For whatever reason this doesn't seem to work for me; please help!

function getToolInfo(lastID) {

    var CamlQuery = "<Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>" + lastID + "</Value></Eq></Where></Query>";
    var CamlViewFields = "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Title' /></ViewFields>";

  // this let me know that the function is getting called and passed the correct parameter value
  alert('function called and passed last ID of : ' + lastID);
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "FirstList",
    CAMLViewFields: CamlViewFields,
    CAMLQuery: CamlQuery,
      completefunc: function (xData, Status) {
        $(xData.responseXML).find("[nodeName='z:row']").each(function() {
        
        // just load a new variable with the returned value        
        var thisID = $(this).attr("ows_ID");
        alert(thisID);
        
      });
    }
  });
}

did I miss something obvious here? basically all the alerts are working except for the last.

enter code hereI am using an example I found on codeplex of SPServices with CamlQuery to try to get list item values with where clause on the ID. For whatever reason this doesn't seem to work for me; please help!

function getToolInfo(lastID) {

    var CamlQuery = "<Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>" + lastID + "</Value></Eq></Where></Query>";
    var CamlViewFields = "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Title' /></ViewFields>";

  // this let me know that the function is getting called and passed the correct parameter value
  alert('function called and passed last ID of : ' + lastID);
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "FirstList",
    CAMLViewFields: CamlViewFields,
    CAMLQuery: CamlQuery,
      completefunc: function (xData, Status) {
        $(xData.responseXML).find("[nodeName='z:row']").each(function() {
        
        // just load a new variable with the returned value        
        var thisID = $(this).attr("ows_ID");
        alert(thisID);
        
      });
    }
  });
}

did I miss something obvious here? basically all the alerts are working except for the last.

Additionally if I remove this line:

$(xData.responseXML).find("[nodeName='z:row']").each(function() {

then i can add alert that works. I have double, triple, etc checked the list item with that ID and it is there.

added 58 characters in body
Source Link
Justin
  • 1.4k
  • 7
  • 27
  • 52

I am using an example I found on codeplex of SPServices with CamlQuery to try to get list item values with where clause on the ID. For whatever reason this doesn't seem to work for me; please help!

function getToolInfo(lastID) {

    var CamlQuery = "<Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>" + lastID + "</Value></Eq></Where></Query>";
    var CamlViewFields = "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Title' /></ViewFields>";

  // this let me know that the function is getting called and passed the correct parameter value
  alert('function called and passed last ID of : ' + lastID);
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "FirstList",
    CAMLViewFields: CamlViewFields,
    CAMLQuery: CamlQuery,
      completefunc: function (xData, Status) {
        $(xData.responseXML).find("[nodeName='z:row']").each(function() {
        
        // just load a new variable with the returned value        
        var thisID = $(this).attr("ows_ID");
        alert(thisID);
        
      });
    }
  });
}

did I miss something obvious here? basically all the alerts are working except for the last.

I am using an example I found on codeplex of SPServices with CamlQuery to try to get list item values with where clause on the ID. For whatever reason this doesn't seem to work for me; please help!

function getToolInfo(lastID) {

    var CamlQuery = "<Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>" + lastID + "</Value></Eq></Where></Query>";
    var CamlViewFields = "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Title' /></ViewFields>";

  // this let me know that the function is getting called and passed the correct parameter value
  alert('function called and passed last ID of : ' + lastID);
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "FirstList",
    CAMLViewFields: CamlViewFields,
    CAMLQuery: CamlQuery,
      completefunc: function (xData, Status) {
        $(xData.responseXML).find("[nodeName='z:row']").each(function() {
        
        // just load a new variable with the returned value        
        var thisID = $(this).attr("ows_ID");
        alert(thisID);
        
      });
    }
  });
}

did I miss something obvious here?

I am using an example I found on codeplex of SPServices with CamlQuery to try to get list item values with where clause on the ID. For whatever reason this doesn't seem to work for me; please help!

function getToolInfo(lastID) {

    var CamlQuery = "<Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>" + lastID + "</Value></Eq></Where></Query>";
    var CamlViewFields = "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Title' /></ViewFields>";

  // this let me know that the function is getting called and passed the correct parameter value
  alert('function called and passed last ID of : ' + lastID);
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "FirstList",
    CAMLViewFields: CamlViewFields,
    CAMLQuery: CamlQuery,
      completefunc: function (xData, Status) {
        $(xData.responseXML).find("[nodeName='z:row']").each(function() {
        
        // just load a new variable with the returned value        
        var thisID = $(this).attr("ows_ID");
        alert(thisID);
        
      });
    }
  });
}

did I miss something obvious here? basically all the alerts are working except for the last.

Source Link
Justin
  • 1.4k
  • 7
  • 27
  • 52

SPService GetListItems with CAML : can't get example to work

I am using an example I found on codeplex of SPServices with CamlQuery to try to get list item values with where clause on the ID. For whatever reason this doesn't seem to work for me; please help!

function getToolInfo(lastID) {

    var CamlQuery = "<Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>" + lastID + "</Value></Eq></Where></Query>";
    var CamlViewFields = "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Title' /></ViewFields>";

  // this let me know that the function is getting called and passed the correct parameter value
  alert('function called and passed last ID of : ' + lastID);
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "FirstList",
    CAMLViewFields: CamlViewFields,
    CAMLQuery: CamlQuery,
      completefunc: function (xData, Status) {
        $(xData.responseXML).find("[nodeName='z:row']").each(function() {
        
        // just load a new variable with the returned value        
        var thisID = $(this).attr("ows_ID");
        alert(thisID);
        
      });
    }
  });
}

did I miss something obvious here?