在 AX 2012 窗体中按名称联接数据源



我正在尝试在我创建的网格中联接多个数据源。 网格位于案例详细信息窗体中,它使用与网格上其他一些组相同的表。 因此,我必须使用基于数据源名称而不是表名称的连接。

有InventTable(InventTableComplaints( - parent和EcoResProductTranslation(EcoResProductTranslationComplaints( - child。

我正在尝试做的是将此代码添加到子数据源:

public void executeQuery()
{
QueryBuildDataSource qbdsIT, qbdsERPTC;
qbdsIT = InventTableComplaint_DS.queryBuildDataSource();
qbdsERPTC = qbdsIT.addDataSource(tableNum(EcoResProductTranslation), "EcoResProductTranslationComplaint");
qbdsERPTC.addLink(fieldNum(InventTable, Product), fieldNum(EcoResProductTranslation, Product));
qbdsERPTC.joinMode( JoinMode::OuterJoin );
qbdsERPTC.fetchMode( QueryFetchMode::One2One );
super();
}

但它不起作用。 可能吗?

您不在executeQuery方法中定义表关系,而是在init方法中执行此操作,该方法只执行一次。如果在表单中定义了数据源(使用InventTableComplaint作为JoinSource,使用OuterJoin作为JoinMode(,则也不需要在init方法中执行此操作,但如果没有作为表关系提供,则可能需要定义链接:

public void init()
{
qbdsIT = InventTableComplaint_DS.queryBuildDataSource();
qbdsERPTC = EcoResProductTranslationComplaint_ds.queryBuildDataSource(); 
qbdsERPTC.clearLinks();
qbdsERPTC.addLink(fieldNum(InventTable, Product), fieldNum(EcoResProductTranslation, Product));
super();
}

请注意,每个InventTable可能存在多个EcoResProductTranslation记录(每种语言都打开(,因此网格中可能会InventTable"重复">

最新更新