通过AOT中的查询进行订购 [英] Make order by with Query in AOT

查看:72
本文介绍了通过AOT中的查询进行订购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在AOT中进行了查询.我的目标是使用CustTable表的Group by"CustGroup"和Order by"count(RecId)" desc打印信息.分组依据工作正常,但排序依据却不起作用.我不明白为什么...

I have made a query in AOT. My goal is to print information using Group by "CustGroup" and Order by "count(RecId)" desc of CustTable table. The group by works properly, but the order by does not. I can not understand why...

这是我的查询内容:

这是我使用的代码:

Static void Query(Args _args)
{
   QueryRun  qr;
   CustTable myCustTable;
;
   qr = new QueryRun(queryStr(MyQuery));
while(qr.next())
{
  myCustTable = qr.get(tableNum(CustTable));
  info(strFmt("Group %1  Num %2", myCustTable.Custgroup, myCustTable.RecId));
}
}

结果是:

推荐答案

AX不会按Count(RecId)进行排序,而是按分组进行排序.

AX does not sort by Count(RecId) but by the grouping.

您可以通过将查询拖动到新视图中,然后对视图的count字段进行排序来解决您的问题.您也可以在不查询的情况下定义视图.

You can solve your problem by dragging your query to a new view, then doing the sort on the count field of the view. You can also define the view without a query.

这篇关于通过AOT中的查询进行订购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆