0

can someone show me a easy way to get information from inventdim? I need to get batchid/ siteid/locationid for a project transaction. D365FO I tried this select but I don't think its accurate enough

while select InventTransOrigin join salesline where SalesLine.InventTransId == InventTransOrigin.InventTransId
        &&  SalesLine.inventtransid == ProjItemTrans::find(projInvoiceItem.ProjTransId).inventtransid
       join inventTrans where InventTrans.InventTransOrigin == InventTransOrigin.RecId
       join inventdim order by inventdim.inventBatchId desc where InventDim.inventDimId == InventTrans.inventDimId 
Tweene
  • 257
  • 4
  • 16
  • Why do you think it is not accurate enough? Also, the join with `SalesLine` is unnecessary, you could join `InventTransOrigin` directly with `ProjItemTrans`. – FH-Inway May 28 '20 at 18:37
  • When I did run this query in sql workbench i got like 100000 records for one transid but they had different batchid's – Tweene May 29 '20 at 06:41
  • Hm, agreed, that does not seem right. I noticed that `ProjItemTrans` also has an `InventDimId` field, why don't you use that? – FH-Inway May 29 '20 at 09:28
  • Well when I tried to connect it thay way I don't get any batchid. I debugged it and no value for bachid is shown but for siteid and locationid its ok. tmpPSAProjInvoice.inventsite = inventdim::find(projitemtrans::find(projInvoiceItem.projtransid).InventDimId).Inventsiteid – Tweene Jun 01 '20 at 09:55

0 Answers0