简体   繁体   English

检测Dynamics-AX-2012中的字段之间是否存在连接

[英]Detect whether the connection exists between fields in Dynamics-AX-2012

I have two tables, table1(fields: playerId, insuranceId) and table2. 我有两个表,table1(字段:playerId,insuranceId)和table2。

How to determine from table2 if the playerId and insuranceId have a connection to each other? 如何从表2中确定playerId和insuranceId是否相互连接?

I mean which player have agreement with which insurance company... 我的意思是哪个球员与哪个保险公司达成协议...

I know that I should override method(which one?) in table to and use table1 exist method to make it work, but I don't know how to do it. 我知道我应该重写表中的方法(哪个?)并使用table1存在的方法来使其工作,但我不知道该怎么做。

I don't sure I understand you correctly, but you create next method on table2 我不确定我是否正确理解您,但是您在table2上创建了下一个方法

public boolean existInTable1()
{
    table1 t;
    ;
    select recid from t where t.playerid == this.playerid && t.insuranceid == this.insuranceid;

    return (t.recid !== 0);
}

And somewhere in code: 在代码中的某处:

table2 t2;
;
select t2;
if(t2.existInTable1()) ...

Updated 更新

Of course, if you have exist-method on table1 you can rewrite existInTable1() like this: 当然,如果在table1上存在存在方法,则可以像下面这样重写existInTable1():

public boolean existInTable1()
{
    ;
    return table1::exist(this.playerid, this.insuranceid);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM