This project has moved and is read-only. For the latest updates, please go here.

How to define more than one <OrderBy><fieldref

Dec 19, 2012 at 10:23 AM

I am not sure if this is the correct way of defining two orderby's in the query as I could not find the documentation regarding this issue. Nor did this work as expected for me.

I am trying this:
query = "<Query><OrderBy><FieldRef Name='Number' Ascending='true' /><FieldRef Name='Number' Ascending='true' /></OrderBy></Query>";

Dec 19, 2012 at 1:38 PM

The syntax looks fine but you're sorting on the same field twice.  Also, Ascending='TRUE' is the default so you can omit that if you like.  The complete CAML reference is available here.