Hello,
I need to connect three tables in a Query in order to get the cartesian product of all three in runtime. How can I achieve this requirenment using Query, QueryBuildDataSource and QueryRun. If I do it in the following matter the tables are fetched one after the other in the queryrun (first all values of "TableBase", second all values of "Table1", third all values of "Table2"). The cursor "qr" never contains all the values at the same time.
Query queryAll = new Query();
QueryBuildDataSource qbds_base = queryAll.addDataSource(tableNum(TableBase));
QueryBuildDataSource qbds_table1 = qbds_base.addDataSource(tableNum(Table1));
qbds_table1.joinMode(JoinMode::InnerJoin);
QueryBuildDataSource qbds_table2 = qbds_base.addDataSource(tableNum(Table2));
qbds_table2.joinMode(JoinMode::InnerJoin);
QueryRun qr = new QueryRun(queryAll);
while (qr.next())
{
TableBase tableBase = qr.get(tableNum(TableBase));
Table1 table1 = qr.get(tableNum(Table1));
Table2 table2 = qr.get(tableNum(Table2));
}
Thanks
Sebastian