Hi Guys,
I am working on a weird issue. I created the following functionality. I know for a fact that there is a salesline with inventdim and itemid that matches with the filters in the where clause.
If i remove the inventdimid i get a total qty of 26 instead which is right but i want to get the qty of the item / inventdimid and get that qty. i even removed all the group by and sum in the select and created this less performing query to debug it.
When i run it as a job it is working. When i run it (yes i debugged all the variables are filled i also checked _inventdimId) the query will not have any result
private void insertSalesLineInformation(ForecastItemAllocationId _allocId, ItemId _itemId, InventDimId _inventdimId, utcDateTime _baseDate) { SalesLine salesLine; SalesTable salesTable; SalesQty salesQty; ForecastItemAllocationLine forecastItemAllocationLine; ttsBegin; while select salesLine where salesLine.InventDimId == _inventdimId && salesLine.ItemId == _itemId && salesLine.createdDateTime >= _baseDate && salesLine.SalesStatus == (SalesStatus::Backorder || SalesStatus::Invoiced) && salesLine.SalesQty <= 10 { salesQty = salesQty + salesLine.SalesQty; } if (salesQty > 0) { forecastItemAllocationLine.AllocationId = _allocId; forecastItemAllocationLine.ItemId = _itemId; forecastItemAllocationLine.InventDimId = _inventDimId; forecastItemAllocationLine.HSOMixLines = salesQty; forecastItemAllocationLine.initValue(); if (forecastItemAllocationLine.validateWrite()) { forecastItemAllocationLine.insert(); } }
ttsCommit; }
*This post is locked for comments