1

How would I use SPServices GetListItems and still be able to add Ascending=False to the CAMLViewFields? I haven't used this for long and I am just wondering if this is possible?

Thanks as always!

5

You can specify the Ascending=False as an attribute of the FieldRef in the OrderBy element.

 $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "EmployeeList",
    CAMLViewFields: "<ViewFields></ViewFields>",
    CAMLQuery: "<Query><Where><Eq><FieldRef Name='EmployeeID'/><Value Type='Text'>1</Value></Eq></Where><OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy></Query>",
    CAMLRowLimit: 1,
    completefunc: function (xData, Status) {

      });
    }
  });
}
| improve this answer | |
0
 $(document).ready(function() { 

var idquery=""; 
$().SPServices({
 operation: "GetListItems", 
async: false, 
listName: "test", 
CAMLQuery: idquery, 
CAMLRowLimit: 1, 
completefunc: function (xData, Status) 
{ 
$(xData.responseXML).SPFilterNode("z:row").each(function() { //alert($(this).attr("ows_Title")); 
var getvalue= parseInt($(this).attr("ows_Title"))+1;//Auto increment value $("input[title='TicketNumber']").val(getvalue);

        });
     } 
    });

Full details

| improve this answer | |
  • Just code will not help future readers. Please add some content of description from the link you have provided. – Asad Refai Oct 7 '15 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.