I can see where to join two data sources on a form. And I can see the join type. I am missing where you specify the column in each of the tables to make the join. So by entering the source table and the join type HOW does AX know which columns from the two tables it should use to make the join?
0
Comments
You have to use the addLink method at the second dataSource to add the relation. Here a brief example: (Please look up at the last code line)
query = new Query();
// Add the first data source to the query
queryBuildDataSource1 = query.addDataSource(tablenum(SalesTable));
// Add the range to this first data source
queryBuildRange = queryBuildDataSource1.addRange(fieldnum(SalesTable, deliveryDate));
//Secound data Source
queryBuildDataSource2 = queryBuildDataSource1.addDataSource(tablenum(SalesLine));
// Add the link from the child data source to the parent datasource
queryBuildLink = queryBuildDataSource2.addLink(fieldnum(SalesTable,SalesId),fieldnum(SalesLine, SalesId));