how to join more than 2 datasource using query build datasource ax2012

hi all

anyone pls give me sample code to joing more than 2 datasource using query build datasource ax2012.

thanks in advance.

AX is full of such examples…

Nevertheless if you know how to add the second data source, you already know how to add a third one as well, because it’s exactly the same: oneDataSource.addDataSource(…).

here is the sample code

static void QueryExample(Args _args)

{

Query query;

QueryBuildDatasource datasource;

query = new Query();// Add SalesTable main datasource

datasource = query.addDataSource(tableNum(SalesTable)); // Add child datasource “SalesLine” to previously created DS datasource = datasource.addDataSource(tableNum(SalesLine)); // Set the join mode datasource.joinMode(JoinMode::InnerJoin); // Indicate you don’t want to use relations automatically datasource.relations(false); // Add link between parent field and child field

datasource.addLink(fieldNum(SalesTable, SalesId), fieldNum(SalesLine, SalesId));

info(query.xml()); }