在Dynamics AX 2012中获得客户或潜在客户 [英] Get customer or prospects in Dynamics AX 2012

查看:94
本文介绍了在Dynamics AX 2012中获得客户或潜在客户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用X ++吸引客户或潜在客户,并将其用于查找. DirPartyTable中有一种方法可以返回我想要的内容.

I am trying to get customer or prospect using X++ and use it on a lookup. There is a method in the DirPartyTable that returns what I want.

DirPartyTable::isCustomerOrRelation

while select * from dirPartyTable
{
       if(DirPartyTable::isCustomerOrRelation(dirPartyTable.RecId))
       {

                //Get the Name
                //info(dirPartyTable.Name);
       }
}

但是当我对查询建立查询时,我试图以某种方式在查询的addRange上传递DirPartyTable::isCustomerOrRelation(dirPartyTable.RecId). 有办法做到还是不可能?

But when I build a query to the lookup I am trying to pass the DirPartyTable::isCustomerOrRelation(dirPartyTable.RecId) on the addRange of the query somehow. Is there a way to do it or is it impossible ?

推荐答案

如果您查看isCustomerOrRelation(以及isCustomerisRelation)的来源,则看到该方法会在客户或潜在客户返回true的情况下返回true.现有公司中存在.

If you go to the source of isCustomerOrRelation (and isCustomer and isRelation) you see, that the method returns true if a customer or prospect exists in the current company.

您的while select虽然正确,但效率低下,因为它可能必须扫描一百万方以选择当前公司中存在的数千个客户或潜在客户.

Your while select, while correct, is inefficient, because it may have to scan a million parties to select on thousand customers or prospects present in you current company.

更有效但语法上不合法的while select将是:

A more efficient, but syntactical illegal, while select would be:

while select * from dirPartyTable
   exists join custTable
   where custTable.Party == dirPartyTable.RecId
   union 
   select * from dirPartyTable
   exists join smmBusRelTable
   where smmBusRelTable.Party == dirPartyTable.RecId;
{
     info(dirPartyTable.Name);
}

虽然在X ++中是非法的,但可以使用查询和视图.

While illegal in X++ it is possible using queries and views.

  1. 进行两个查询(自己转换为适当的属性):

  1. Make two queries (translate to appropriate properties yourself):

查询1:

select * from dirPartyTable
    exists join custTable
    where custTable.Party == dirPartyTable.RecId

  • 查询2:

  • Query2:

    select * from dirPartyTable
        exists join smmBusRelTable
        where smmBusRelTable.Party == dirPartyTable.RecId;
    

  • 根据查询创建两个视图(View1和View2).

  • Make two views (View1 and View2) based on the queries.

    进行联合查询(Query3),了解如何合并数据联合查询中的来源,请记住指定UnionType(UnionUnianAll).

    Make a union query (Query3), see how to Combine Data Sources in a Union Query, remember to specify the UnionType (Union or UnianAll).

    基于Query3进行查看,了解如何创建一个基于查询的视图.

    Make a view based on the Query3, see how to Create a View Based on a Query.

    结果,使用X ++选择所有记录:

    Result, select all records using X++:

    while select * from dirPartyCustOrRelationTable
    {
         info(dirPartyCustOrRelationTable.Name);
    }
    

    或者您可以直接使用Query3检索记录.

    Or you can use the Query3 directly to retrieve the records.

    这篇关于在Dynamics AX 2012中获得客户或潜在客户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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