CAML Query with RowLimit

Mar 9, 2011 at 6:50 PM

When I'm running my CAML query through SPServices, I've noticed that using this code, I still get all rows returned:

<RowLimit Paged='FALSE'>1</RowLimit>

But when I send in something like this:

	$().SPServices({
		operation: "GetListItems",
		async: false,
		listName: "Employee Evaluations",
		//CAMLViewFields: camlViewFields,
		CAMLQuery: camlQuery,
		CAMLRowLimit: 1,
		completefunc: function (xData, Status) {.....

What are you doing differently or is RowLimit not the same as your CAMLRowLimit?

Mar 9, 2011 at 7:58 PM

Based on looking at what Marc has done and my own research, I think that you have 2 options with regard to the row limit. If you use a view in your SPServices call your rowlimit should be respected. If you do as you did using the CAMLRowLimit this will also be respected. I have not had much luck getting any other method to work. I hope that made sense!

Coordinator
Mar 9, 2011 at 9:08 PM

Dan's right. If you don't specify any changes, then the default view is used. That's why in many of the value-added functions in SPServices, you'll see me specify CAMLRowLimit: 0. That (and any other specific changes) basically "breaks" the connection to the default view and lets me get whatever I want.

When I first built the code to work with GetListItems and UpdateListItems, I created the option called CAMLRowLimit instead of using the same name as the operation, which is rowLimit. In SPServices, I do the "translation". In retrospect, I should have used the same parameter name, and I have done so since the first bunch of operations I wrapped.

M.

Mar 9, 2011 at 9:25 PM

So what's happening is even though my CAMLQuery has a RowLimit set, it's being converted to a "0" by the default behavior in SPServices.  I stepped through the source and now I do see these values.  Some have one, most have 0...  I can dig it.

 

Thanks guys!