views:

1519

answers:

1

Hi

I'm using the content query web part and have exported it to a webpart file to allow me to change the queryoverride and groupby elements.

I want to group the results alphabetically, so I thought that I can maybe use a function to grab the first letter of the title of the list items and then group by this, it might do the trick. Problem is I dont see any way of doing this inside the webpart file, can I use CAML to do this?

A
a.doc
aston.doc
aaa.doc

B
b.doc
box.doc
bbb.doc

Would appreciate anyones suggestions.

+4  A: 

To do this you'd need to call some sort of substring function within your CAML query to get the first letter. Unfortunately this isn't possible.

I'd use CAML to do the sorting, e.g...:

<Query>
   <OrderBy>
      <FieldRef Name='Title' />
   </OrderBy>
</Query>

...then use the XSLT functionality in the Content Query Web Part to group by the first letter.

Alex Angas