09.04.2016, 07:04 | #1 |
Участник
|
Ошибка в запросе
Добрый день! Скажите пожалуйста почему в инвент трансе не выбирается количество,
X++: qbdsInventTrans = query.addDataSource(tableNum(InventTrans)); qbdsInventTrans.orderMode(OrderMode::GroupBy); qbdsInventTrans.addSelectionField(fieldNum(InventTrans,Qty),SelectionField::Sum); qbdsInventTrans.addSelectionField(fieldNum(InventTrans,CostAmountPosted),SelectionField::Sum); qbdsInventTrans.addSelectionField(fieldNum(InventTrans,CostAmountAdjustment),SelectionField::Sum); qbdsInventTrans.addRange(fieldNum(InventTrans,Qty)).value(strfmt("!=%1",0)); qbdsInventTrans.addRange(fieldNum(InventTrans,statusReceipt)).value(strfmt("<=%1",StatusReceipt::Received)); qbdsInventTrans.addRange(fieldNum(InventTrans,statusIssue)).value(strfmt("<=%1",StatusIssue::Sold)); qbdsInventTable = qbdsInventTrans.addDataSource(tableNum(InventTable)); qbdsInventTable.orderMode(OrderMode::GroupBy); qbdsInventTable.addSortField(fieldNum(InventTable,ItemId)); qbdsInventTable.addSortField(fieldNum(InventTable,ItemType)); qbdsInventTable.joinMode(JoinMode::InnerJoin); qbdsInventTable.fetchMode(QueryFetchMode::One2One); qbdsInventTable.relations(true); qbdsInventDim = qbdsInventTrans.addDataSource(tableNum(InventDim)); qbdsInventDim.orderMode(OrderMode::GroupBy); qbdsInventDim.addSortField(fieldNum(InventDim,InventBatchId)); qbdsInventDim.addSelectionField(fieldNum(InventDim,InventBatchId)); qbdsInventDim.joinMode(JoinMode::InnerJoin); qbdsInventDim.fetchMode(QueryFetchMode::One2One); qbdsInventDim.relations(true); qbdsInventTransOrigin = qbdsInventTrans.addDataSource(tableNum(InventTransOrigin)); qbdsInventTransOrigin.orderMode(OrderMode::GroupBy); qbdsInventTransOrigin.addSortField(fieldNum(InventTransOrigin,ReferenceCategory)); qbdsInventTransOrigin.addSelectionField(fieldNum(InventTransOrigin,ReferenceCategory)); qbdsInventTransOrigin.joinMode(JoinMode::InnerJoin); qbdsInventTransOrigin.fetchMode(QueryFetchMode::One2One); qbdsInventTransOrigin.relations(true); qbdsInventJournalTable = qbdsInventTransOrigin.addDataSource(tableNum(InventJournalTable)); qbdsInventJournalTable.orderMode(OrderMode::GroupBy); qbdsInventJournalTable.addSortField(fieldNum(InventJournalTable,JournalId)); qbdsInventJournalTable.joinMode(JoinMode::InnerJoin); qbdsInventJournalTable.fetchMode(QueryFetchMode::One2One); qbdsInventJournalTable.addLink(fieldNum(InventTransOrigin,ReferenceId),fieldNum(InventJournalTable,JournalId)); qbdsInventJournalTable.addRange(fieldnum(InventJournalTable, DKL_TransDate)).value(queryrange(dateFrom, dateTo)); qbdsInventJournalTable.addRange(fieldnum(InventJournalTable, Posted)).value(queryValue(NoYes::Yes)); qbdsInventJournalTable.addRange(fieldnum(InventJournalTable, JournalType)).value(queryvalue(InventJournalType::Transfer)); qrType = qbdsInventJournalTable.addRange(fieldnum(InventJournalTable, MEL_OperationType)); qbdsInventLocationFrom = qbdsInventJournalTable.addDataSource(tablenum(InventLocation)); qbdsInventLocationFrom.orderMode(OrderMode::GroupBy); qbdsInventLocationFrom.addSortField(fieldNum(InventLocation,InventLocationId)); qbdsInventLocationFrom.addSortField(fieldNum(InventLocation,Name)); qbdsInventLocationFrom.addSortField(fieldNum(InventLocation,InventLocationType)); qbdsInventLocationFrom.joinMode(JoinMode::InnerJoin); qbdsInventLocationFrom.fetchMode(QueryFetchMode::One2One); qbdsInventLocationFrom.addLink(fieldnum(InventJournalTable, DKL_InventLocationId), fieldnum(InventLocation, InventLocationId)); qbdsInventLocationTo = qbdsInventJournalTable.addDataSource(tablenum(InventLocation)); qbdsInventLocationTo.orderMode(OrderMode::GroupBy); qbdsInventLocationTo.addSortField(fieldNum(InventLocation,InventLocationId)); qbdsInventLocationTo.addSortField(fieldNum(InventLocation,Name)); qbdsInventLocationTo.addSortField(fieldNum(InventLocation,InventLocationType)); qbdsInventLocationTo.joinMode(JoinMode::InnerJoin); qbdsInventLocationTo.fetchMode(QueryFetchMode::One2One); qbdsInventLocationTo.addLink(fieldnum(InventJournalTable, DKL_InventLocationIdTo), fieldnum(InventLocation, InventLocationId)); |
|
09.04.2016, 09:40 | #2 |
Участник
|
Цитата:
Сообщение от arhat
Добрый день! Скажите пожалуйста почему в инвент трансе не выбирается количество,
X++: qbdsInventTrans.addSelectionField(fieldNum(InventTrans,Qty),SelectionField::Sum); qbdsInventTrans.addSelectionField(fieldNum(InventTrans,CostAmountPosted),SelectionField::Sum); qbdsInventTrans.addSelectionField(fieldNum(InventTrans,CostAmountAdjustment),SelectionField::Sum); qbdsInventTrans.addRange(fieldNum(InventTrans,Qty)).value(strfmt("!=%1",0)); qbdsInventTrans.addRange(fieldNum(InventTrans,statusReceipt)).value(strfmt("<=%1",StatusReceipt::Received)); qbdsInventTrans.addRange(fieldNum(InventTrans,statusIssue)).value(strfmt("<=%1",StatusIssue::Sold)); |
|
09.04.2016, 09:46 | #3 |
Участник
|
Да схлопвались в ноль! Проблему решил другим способом. Сделал проверку на склады не в запросе, но очень интересно, потому что этот запрос работал на ax 2009. а на 2012 сделал джойн InventTransOrigin в остальном все в одни в один.
|
|
09.04.2016, 10:13 | #4 |
Участник
|
Вы склады достаёте из шапок журнала? Почему не из проводок?
|
|
09.04.2016, 11:00 | #5 |
Участник
|
|
|
Теги |
запросы |
|
Похожие темы | ||||
Тема | Ответов | |||
Ошибка в запросе - Почему не работает?? | 3 | |||
Ошибка в логе при установке клиента AX 2009 | 9 | |||
Ошибка в запросе | 6 | |||
Русская локализация Axapta 3 ? | 59 | |||
ошибка в запросе | 3 |
|