Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Group By in CAML query

$
0
0

I have the following CAML query:

		listQuery = "<Query>";
		listQuery += "	<GroupBy collapse='true'>";
		listQuery += "    <FieldRef Name='DepartmentName' />";
		listQuery += "  </GroupBy>";
		listQuery += "  <OrderBy>";
		listQuery += "    <FieldRef Name='DepartmentName' />";
		listQuery += "  </OrderBy>";
		listQuery += "  <ViewFields>";
		listQuery += "    <FieldRef Name='DepartmentID' />";
		listQuery += "    <FieldRef Name='DepartmentName' />";
		listQuery += "  </ViewFields>";
		listQuery += "</Query>";

I'm trying to get a unique list of department names.  However, I am getting multiple instances of each department (in essence one per record in the underlying record).  What is wrong with my GroupBy tag?

Thanks,

- Bruce


- Bruce


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>