本文介绍了对具有聚合OData版本4的Apply的结果执行OrderBy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑我有一个像这样的odata查询:
Consider I have an odata query like this:
Sessions?$apply=filter(SomeColumn eq 1)/groupby((Application/Name), aggregate(TotalLaunchesCount with sum as Total))
会话和应用程序实体通过ApplicationId链接.我想在总计"上应用orderby,并获得odata查询响应的前5个结果.
Sessions and Application entities are linked by ApplicationId. I want to apply orderby on "Total" and get top 5 results as odata query response.
我尝试在上述查询的末尾添加&$top=5
.它说:
I tried adding &$top=5
at the end of the above mentioned query. Its says:
有人可以告诉我是否支持这种查询吗?
Can anyone tell me if such query is supported?
推荐答案
受支持. $ skip,$ top,$ orderby是根据$ apply链的结果执行"的.在这种情况下,查询应如下所示:
It is supported. $skip, $top, $orderby are "performed" on result from $apply chain.In this case query should looks like this:
Sessions?$apply=filter(SomeColumn eq 1)
/groupby((Application/Name), aggregate(TotalLaunchesCount with sum as Total))
&$orderby=Total
&$top=5
这篇关于对具有聚合OData版本4的Apply的结果执行OrderBy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!