Add tables to query build datasource ,addlink,relation
static void QBDSExample(Args _args)
{
Query query;
QueryBuildDatasource datasource;
;
query = new Query();
// Add purchtable main datasource
datasource = query.addDataSource(tableNum(purchtable));
// Add child datasource "purchline"
datasource = datasource.addDataSource(tableNum(purchline));
// Set the join mode
datasource.joinMode(JoinMode::InnerJoin);
datasource.relations(false);
datasource.addLink(fieldNum(purchtable, purchid),
fieldNum(purchline, purchid));
info(query.xml());
}