【问题标题】:Detect whether the connection exists between fields in Dynamics-AX-2012检测 Dynamics-AX-2012 中的字段之间是否存在连接
【发布时间】:2014-02-25 19:30:48
【问题描述】:

我有两个表,table1(fields: playerId, insuranceId) 和 table2。

如何从table2中判断playerId和insuranceId是否有关联?

我的意思是哪个玩家与哪个保险公司有协议...

我知道我应该重写 table 中的方法(哪个?)并使用 table1 存在的方法使其工作,但我不知道该怎么做。

【问题讨论】:

  • 可以提供table2的字段吗?
  • playerId、insuranceId 和 scoutId
  • 这只是一个了解基础知识的示例项目:))))
  • 如果表是相关的,并且表设计遵循最佳实践,则应该有一些关系或/和删除操作。您可以在 AOT 中快速检查。
  • @TBM - 我希望你不只是来这里完成你的作业......

标签: sql axapta x++ dynamics-ax-2012 morph-x


【解决方案1】:

我不确定我是否理解正确,但你在 table2 上创建了下一个方法

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

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

在代码中的某处:

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

更新

当然,如果你在 table1 上有exist-method,你可以像这样重写existInTable1():

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多