3

I'm using the SPServices GetListItems function to pull entries from a calendar list. All of the information is being retreived without any issues. However the RowLimit is not restricting the number of items being returned.

camlQuery = "<Query>"
                +"<CalendarDate>" + calendarDate + "</CalendarDate>
                +"<Where>"
                    +"<DateRangesOverlap>"
                        +"<FieldRef Name='EventDate' />"
                        +"<FieldRef Name='EndDate' />"
                        +"<FieldRef Name='RecurrenceID' />"
                        +"<Value Type='DateTime'>Month</Value>"
                    +"</DateRangesOverlap>"
                +"</Where>"
                +"<OrderBy>"
                    +"<FieldRef Name='EventDate' />"
                +"</OrderBy>"
                +"<RowLimit>6</RowLimit>"
            +"</Query>";
1
  • You need to make sure that the Web application associated with the site does not have a row limit more than what you expect. Oct 8, 2014 at 15:01

4 Answers 4

6

In the SPServices library, you just need to add an option like this in your GetListItems configuration:

CAMLRowLimit: 6

Marc then tacks this onto the appropriate place in the dynamically built CAML query to get your data.

15

Your <RowLimit> tag is inside <Query> tag which is wrong, it should be out side the <Query> and inside <View>.

Try below

camlQuery = "<View><Query><CalendarDate>" + calendarDate + "</CalendarDate><Where><DateRangesOverlap><FieldRef Name='EventDate' /><FieldRef Name='EndDate' /><FieldRef Name='RecurrenceID' /><Value Type='DateTime'>Month</Value></DateRangesOverlap></Where><OrderBy><FieldRef Name='EventDate' /></OrderBy></Query><RowLimit>6</RowLimit></View>";
2
SPQuery query = new SPQuery();
query.RowLimit = 10;
SPListItemCollection items = list.GetItems(query);
1
  • Love it when the simple answers work.
    – da_jokker
    Aug 19, 2015 at 16:50
0

Can you try this CAMLRowLimit,

$(document).ready(function() {
    //alert("ASD");
    var idquery="<Query><OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy></Query>";
        $().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);

    });
    }
    });


    <a href="http://peakfinders.blogspot.com/2015/10/how-to-get-id-of-last-inserted-row-in.html">more details</a>
1
  • 1
    Can you please add some description of your answer. Just code do not give a clue.
    – Asad Refai
    Oct 7, 2015 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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