简体   繁体   中英

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

I have two tables, table1(fields: playerId, insuranceId) and table2.

How to determine from table2 if the playerId and insuranceId have a connection to each other?

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.

I don't sure I understand you correctly, but you create next method on 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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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