Dear All,
I wrote below query and it's working fine. I have one question when to make it datasource.relations(True) OR datasource.relations(false) ?
static void TM_AS_Query(Args _args)
{
Query query;
QueryBuildDatasource datasource;
;
query = new Query();// Add SalesTable main datasource
datasource = query.addDataSource(tableNum(SalesTable));
datasource = datasource.addDataSource(tableNum(SalesLine));
datasource.joinMode(JoinMode::InnerJoin);
datasource.relations(false);
datasource.addLink(fieldNum(SalesTable, SalesId), fieldNum(SalesLine, SalesId));
}
Please give me more shed on this.
Thanks!
Arpan Sen
*This post is locked for comments
Ohh.. Sorry
Thanks Vilmos
The opposite. Read what I said one more time.
Thanks Vilmos,
As i understood means if i am going to create a relation between SalesTable and SalesLine with Sales Id filed ( Which is already there in SalesLine table) so, i need to make it
QueryBuildDatasource qbdsSalesTable, qbdsSalesLine;
qbdsSalesTable.relations(false); // False
If i want to do some other relation which is not exist in SalesLine table then i need to put
qbdsSalesTable.relations(True); // True
Please verify.
Thanks!
Arpan Sen
It is quite obvious. If there is relations defined between the tables or their EDTs are linked to tables, AX would know what the relation is, in which case setting relations(true) would establish the connection between them for you automagically.
If there are no relations defined or you want to change how they are linked, you can override that with relations(false), and define how to link, based on what record context.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156