Every time I add query "where" - I get 500

Feb 1, 2011 at 5:05 AM

This is probably something silly, but I just cannot get basic "getListItems" with query to work.

If my query contains only "OrderBy" - everything is fine. But as soon as I add <Where> clause, all hell breaks loose.

 

Here is what I am trying:

var camlQuery="<Query> \
 		<Where><neq><FieldRef Name='Seat'></FieldRef><Value Type='Text'>1</Value></neq></Where>\
 		<OrderBy><FieldRef Name='Seat'/></OrderBy>\
 		</Query>";
 $(document).ready(function() {
   $().SPServices({
  		operation: "GetListItems",
  		listName: "Seating Chart",
  		CAMLQuery: camlQuery,
  		CAMLViewFields: "<ViewFields><FieldRef Name='Location' /><FieldRef Name='Suite' /><FieldRef Name='Seat' /><FieldRef Name='User' /></ViewFields>",
  		completefunc: processResult
  	});  
});

And it gets 500. If I remove the second line (the "where" clause) it works fine. 
I have tried every variation I could think of on the where clause, and they all result in 500. HELP!!!
-HH
Feb 1, 2011 at 9:31 AM

Have you tried capitalizing the "N" in neq. I beleive that Neq is the correct CAML syntax

var camlQuery="<Query><Where><Neq><FieldRef Name='Seat'/><Value Type='Text'>1</Value></Neq></Where><OrderBy><FieldRef Name='Seat'/></OrderBy></Query>";

Feb 1, 2011 at 1:12 PM

Within the "where" portion of the query statement, the FieldRef tag should look like the following (and you should delete the </FieldRef>).

<FieldRef Name='Seat' />





        
    
Feb 1, 2011 at 4:54 PM
spevilgenius wrote:

Have you tried capitalizing the "N" in neq. I beleive that Neq is the correct CAML syntax

var camlQuery="<Query><Where><Neq><FieldRef Name='Seat'/><Value Type='Text'>1</Value></Neq></Where><OrderBy><FieldRef Name='Seat'/></OrderBy></Query>";

Thats funny, I could have sworn I tried that many times, but sure enough, it is simply case sensitive, and works fine when capitalized.

Thank you so much - this makes my day!!!

Feb 1, 2011 at 5:24 PM

Awesome! Glad I could help!