自定义查找和分组依据 [英] Custom Lookup and Group By

查看:86
本文介绍了自定义查找和分组依据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TLDR:当使用查找的字段不为空时,为什么在查找中禁用了group by子句?

TLDR: Why group by clauses are disabled in lookups when the field using the lookup is not empty?

我想在表单中的字段上进行自定义查找.表CTable看起来像这样:

I want to do a custom lookup on a field in a form. The table CTable looks like this:

Val Spec
------------
A   alpha
A   beta
A   gamma
B   delta
C   epsilon

查找仅涉及Val列,该列是使用具有基本关系的EDT定义的:Val == CTable.Val

The look up only concerns the Val column which is defined using an EDT with a basic relationship on it: Val == CTable.Val

查找显然给了我这样的列表:

The lookup obviously gives me a list like this:

A
A
A
B
C

让我们分组讨论,以消除所有重复的As,我想! 类似于:

Let's to a group by to get rid of all the duplicated As, I thought! Something along the lines of:

QueryBuildDataSource.orderMode(OrderMode::GroupBy);
QueryBuildDataSource.addGroupByField(fieldNum(CTable, Val));

现在出现了我的怪异行为以及问题的实质.在一个空字段上,正确执行了分组依据,我得到了:

Now comes the strange behaviour I have and the actual point of my question. On an empty field, the group by is correctly executed and I get this:

A
B
C

现在让我们在查找中选择"A",然后再次执行查找 ,因为我想单击"B".现在,由于未知原因,group by被禁用了,我得到的查找结果与之前的查找结果相同.

Now let's select "A" in the lookup, then perform the lookup again because I wanted to click on "B" instead. The group by is now disabled for unknown reasons and I get the same look up results as the first I had before.

为什么会这样?我该如何克服?

Why is it so? How can I overcome that?

推荐答案

相同的问题和有用的答案: http://dynamicsuser.net/forums/t/63438.aspx

Same question and usefull answer: http://dynamicsuser.net/forums/t/63438.aspx

您可以通过将SysTableLookup中的useLookupValues设置为false来禁用此行为.不幸的是,我不知道为什么AX会这么做.我怀疑它会将OrderMode更改为OrderBy.

You can disable this behavior by setting useLookupValues in SysTableLookup to false. Unfortunately I don't know exactly why AX does that. I suspect that it changes OrderMode to OrderBy.

这篇关于自定义查找和分组依据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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