Sharepoint 列表 - GroupBy?
我正在尝试从 Sharepoint 列表中获取数据并将其放入一些 Flex 图表中。 我可以使用 CAML 查询很好地调用列表数据,但我想使用 GroupBy 按团队合并行。 因此,例如团队 1 可能有 20 条记录,团队 2 可能有 8 条记录,团队 3 可能有 25 条记录...我不想显示 53 条记录,而是显示 3 条...只是“团队 1,团队 2,第 3 队”以及每次参赛费用的总和。
我看到 CAML 提供了 GroupBy 元素,但我似乎无法让它工作。 另外,只有当我使用 OrderField 元素而不是像 90% 的书籍和网站推荐的 FieldRef 元素时,我才能使 OrderBy 元素正常工作。 如果我确实使用 FieldRef,OrderBy 将不再起作用,这对我来说毫无意义。 一定有问题...
这是我的 CAML 查询,因为它代表...
---------------------------------------------------
<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>
---------------------------------------------------
这是 OrderBy 工作,但 GroupBy 不工作。 帮助!
谢谢!
I'm trying to get data from a Sharepoint list and put it into some Flex graphs. I can call the list data just fine using a CAML query, but I want to use a GroupBy to consolidate the rows by Teams. So, for example Team 1 may have 20 records, Team 2 may have 8 records, and Team 3 might have 25 records... Instead of showing 53 records, I want to show 3... just "Team 1, Team 2, Team 3" and the sum of the cost of each entry.
I see where CAML provides a GroupBy element, but I can't seem to get it to work. Also, I was only able to get the OrderBy element to work when I used the OrderField element instead of the FieldRef element like 90% of the books and websites recommend. If I do use FieldRef, OrderBy doesn't work anymore, which makes no sense to me. Something must be awry...
Here is my CAML Query as it stands...
---------------------------------------------------
<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 is with OrderBy working, but GroupBy not working. Help!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我运行了以下查询,似乎对我来说工作得很好。
我建议您使用 U2U CAML 查询生成器工具来构建和测试您的查询
I ran the following query and seems to be working fine for me.
I suggest you use the U2U CAML Query Builder tool to build and test your query's