I have looked around a bit, but have not found any reference to this particular issue. Is it possible to specify a custom ordering in a CAML query? What I mean by this is, say I have a list with a column that contains values 'Apple', 'Orange', and 'Grape', and I would like to create a CAML query that will group items by these values, order them within the groups and return the whole list ordered as ['Orange', 'Apple', 'Grape']. Is there a way to specify such an ordering?
You can do that using the
GroupBy attribute in CAML query. Here is a link of how to format your caml to include the GroupBy statement: