16.07.2010, 10:54 | #1 |
Участник
|
QueryRun и два Join'а
Доброго времени суток!
Столкнулся со следующей проблемой: QueryRun не понимает два join к одному datasource. Есть запрос: Код: select * from SalesTable join CustTable on CustTable.AccountNum == SalesTable.CustAccount join SalesLine on SalesLine.SalesId == SalesTable.SalesId where SalesTable.SalesStatus == SalesStatus::Backorder && SalesLine.InventQtyReserve <> 0 X++: #define.RecId('RecId') Query query = new Query(); QueryBuildDataSource qbdsSalesTable; QueryBuildDataSource qbdsCustTable; QueryBuildDataSource qbdsSalesLine; ; qbdsSalesTable = SysQuery::findOrCreateDatasource(query, tablenum(SalesTable)); qbdsCustTable = SysQuery::findOrCreateDatasource(query, tablenum(CustTable), tablenum(SalesTable), false); qbdsSalesLine = SysQuery::findOrCreateDatasource(query, tablenum(SalesLine), tablenum(SalesTable), false); qbdsCustTable.addLink(fieldnum(SalesTable, CustAccount), fieldnum(CustTable, AccountNum)); qbdsSalesLine.joinMode(JoinMode::ExistsJoin); qbdsSalesLine.fields().dynamic(boolean::false); qbdsSalesLine.fields().clearFieldList(); qbdsSalesLine.addSelectionField(fieldname2id(qbdsSalesLine.table(), #RecId)); SysQuery::findOrCreateRange(qbdsSalesLine, fieldnum(SalesLine, InventQtyReserv)).value(SysQuery::valueNot(0)); qbdsSalesLine.addLink(fieldnum(SalesTable, SalesId), fieldnum(SalesLine, SalesId)); SysQuery::findOrCreateRange(qbdsSalesTable, fieldnum(SalesTable, SalesStatus)).value(SysQuery::value(SalesStatus::Backorder)); SysQuery::findOrCreateRange(qbdsSalesTable, fieldnum(SalesTable, TotalAmountCurReserve)).value('> 0'); queryRun = new QueryRun(query); Microsoft Businness Solutions-Axapta 3.0 Build #1951.3730/514-193 SP3/OP023-71 Последний раз редактировалось Roman N. Krivov; 16.07.2010 в 10:57. |
|
Теги |
join, query, как правильно |
|
|