Sharepoint Lists - GroupBy?
I am trying to get data from a Sharepoint list and put it in some Flex graphs. I can just call the list of data using a CAML query, but I want to use GroupBy to consolidate rows with commands. So, for example, Team 1 can have 20 entries, Team 2 can have 8 entries, and Team 3 can have 25 entries ... Instead of showing 53 entries, I want to show 3 ... just "Team 1 , Team 2, Team 3 "and the sum of the cost of each entry.
I can see where CAML provides the GroupBy element, but I can't seem to get it to work. Also, I was able to get the OrderBy element when I used the OrderField element instead of the FieldRef element, for example 90% of books and websites recommend it. If I use FieldRef, OrderBy doesn't work anymore, which doesn't make any sense to me. Something must be wrong ...
Here is my CAML request as it costs ...
---------------------------------------------------
<queryRequest xmlns="http://schemas.microsoft.com/sharepoint/dsp">
<dsQuery resultContent="dataOnly" resultRoot="Rows" resultRow="Row" columnMapping="attribute">
<ViewFields>
<FieldRef Name="Team"></FieldRef>
<FieldRef Name="Cost"></FieldRef>
<FieldRef Name="EANo"></FieldRef>
</ViewFields>
<Query>
<GroupBy collapse="true">
<FieldRef Name="Team"/>
</GroupBy>
<OrderBy>
<OrderField Name="Cost"/>
</OrderBy>
</Query>
</dsQuery>
</queryRequest>
---------------------------------------------------
This works with OrderBy, but GroupBy doesn't. Help!
Thank!