using a variable in CAMLQuery and ows_ problem

Jan 13, 2012 at 8:34 PM
Edited Jan 13, 2012 at 8:35 PM

I've got a getlistitems query that's almost working but I have 2 problems. Here is the code:

$().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Communications Services Request Form",
    CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Number'>51</Value></Eq></Where></Query>",
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var varChecked = $(this).attr("ows_CheckedOutTo");
        alert(varChecked);
      });
    }
  });

I want to repalce the 51 in the CAML Query with a variable and the "ows_CheckedOutTo" returns as undefined, despite there being a column called "CheckedOutTo" in my list.

Thanks for the help.

Jan 13, 2012 at 8:42 PM

I sorted the variable:

CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Number'>" + varID + "</Value></Eq></Where></Query>",

Nothing on the ows_ problem, though,

Jan 13, 2012 at 9:14 PM

figured it out. That was the bevahiour I wanted, but I was getting confused.

Coordinator
Jan 17, 2012 at 1:33 PM

Glad you solved it. It's always nice to watch the process!

M.