Filtering on a linked table in Axapta / Dynamics Ax

I have a form in Axapta / Dynamics Ax (EmplTable) that has two data sources (EmplTable and HRMVirtualNetworkTable), where the second data source (HRMVirtualNetworkTable) is associated with the first one with the link type β€œDelay”.

Is there a way to set a filter in records based on a second data source without changing the type of link to "InnerJoin"?

+3
source share
2 answers

You can use "Outer join" instead of "Delayed" and then programmatically change the connection mode when there is a field search in HRMVirtualNetworkTable.

Add this method to the SysQuery class:

static void updateJoinMode(QueryBuildDataSource qds) { Counter r; if (qds) { qds.joinMode(JoinMode::OuterJoin); for (r = 1; r <= qds.rangeCount(); r++) { if (qds.range(r).value() && qds.range(r).status() == RangeStatus::Open) { qds.joinMode(JoinMode::InnerJoin); break; } } } } 

In execQuery () on an EmplTable data source:

 public void executeQuery() {; SysQuery::updateJoinMode(this.queryRun() ? this.queryRun().query().dataSourceTable(tableNum(HRMVirtualNetworkTable)) : this.query().dataSourceTable(tableNum(HRMVirtualNetworkTable))); super(); } 

Sometimes this.queryRun () returns null, so use this.query () instead.

Update:

Note that this does not apply to AX 2012 and later, where you can use query filters in external connections. See How to use the QueryFilter class with external joins .

+5
source

You can do this programmatically by attaching a QueryBuildDataSource or an advanced filter (Alt + F3, right-click on datasorce, 1: n and find sev \ condary DS)

+1
source

All Articles