SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
up vote 5 down vote accepted

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) {

      });
    }
  });
}
share|improve this answer
    
perfect! thanks; greatly appreciated! – Justin Aug 19 '12 at 0:19
 $(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

share|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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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