0

I've been working on this query for a while now and I can't get it to return any rows. It was working before I added in the content between and added the and statement.

 camlQuery.set_viewXml("<View><Query><OrderBy><FieldRef Name='StartDate'  Ascending='False'/></OrderBy><GroupBy>" + 
 "<FieldRef Name='SortOrder'/></GroupBy>" +
 "<Where>" +
 "<Eq>" +
 "<FieldRef Name='DisplayGroup' />" + 
 "<Value Type='Text'>Home</Value> " +
 "</Eq>" +
 "<And>" +
 "<Leq>" +
 "<FieldRef Name='StartDate' />" +
 "<Value Type='DateTime'>" +
 "<Today />" +
 "</Value>" +
 "</Leq>" +
 "</And>" +
 "</Where>" +
 "</Query>" +
 "</View>");

Thanks in advance for any help.

1

Try the following, <And> should contain two conditions in it.. <Eq> and <Leq> both should appear within the <And>

camlQuery.set_viewXml("<View><Query><OrderBy><FieldRef Name='StartDate'  Ascending='False'/></OrderBy><GroupBy>" + 
 "<FieldRef Name='SortOrder'/></GroupBy>" +
 "<Where>" +
 "<And>" +
    "<Eq>" +
       "<FieldRef Name='DisplayGroup' />" + 
       "<Value Type='Text'>Home</Value> " +
    "</Eq>" +
    "<Leq>" +
       "<FieldRef Name='StartDate' />" +
       "<Value Type='DateTime'>" +
          "<Today />" +
       "</Value>" +
    "</Leq>" +
 "</And>" +
 "</Where>" +
 "</Query>" +
 "</View>");

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.