web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

AX 2012 - How to Add Linked Datasource using parent Datasource fields

Denis Macchinetti Profile Picture Denis Macchinetti 16,444
Hi Guys

Can happen to add Datasource to a query using fields related to other parent Datasource.

In order to achieve this goal, the trick is use the third parameter of the AddLink Kernel Method of the QueryBuildDataSource class, like this:

qbdsXX = SysQuery::FindOrCreateDataSource(DataSource_ds.query(), tableNum(TableChild), tableNum(TableParent) );
qbdsXX.relations(false);
qbdsXX.joinMode(JoinMode::InnerJoin);
qbdsXX.fetchMode(QueryFetchMode::One2Many);
qbdsXX.addLink(fieldNum(TableParent, FieldA), fieldNum(TableChild, FieldA));
qbdsXX.addLink(fieldNum(TableParent, FieldB), fieldNum(TableChild, FieldB));
qbdsXX.addLink(fieldNum(TableParentParent, FieldC), fieldNum(TableChild, FieldC), DataSourceParent );


Stay tuned!

This was originally posted here.

Comments

*This post is locked for comments