I'm doing a report on 'Item ledger entry'. It's not a problem to do CALCFIELDS on amount to show items by customer or vendor with Sales or Purchase amounts using e.g. Vendor, 'Item Ledger Entry, and temp table with Integer loop. it's showing amounts for purchasing with item charges but I'd need it without it. I'm trying to use 'Value Entry' filtering it with 'ValueEntry.SETRANGE("Item Charge No.",''); and ValueEntry.SETRANGE("Item Ledger Entry No.",ItemLedgerEntry."Entry No."); and CULCSUMS. If I run it in a separate codeunit filtering ILE with an Item and 'Posting Date' it's working. But, it didn't work inside the integer loop.
The codeunit code as below is working:
EVALUATE(PostingDate,'2019-01-24');recItemLedgerEntry.SETRANGE(recItemLedgerEntry."Posting Date",PostingDate);EntryNo :=0;CLEAR(recValueEntry);recValueEntry.SETRANGE("Item Charge No.",''); IF recItemLedgerEntry.FINDSET THEN BEGIN REPEAT EntryNo := recItemLedgerEntry."Entry No."; recValueEntry.SETRANGE("Item Ledger Entry No.",EntryNo); MESSAGE(FORMAT(recItemLedgerEntry."Entry No.")); IF recValueEntry.FINDSET THEN BEGIN recValueEntry.CALCSUMS("Purchase Amount (Actual)"); PurchaseAmount2 += recValueEntry."Purchase Amount (Actual)"; END; UNTIL recItemLedgerEntry.NEXT = 0; END;
But, when I'm trying to use/insert it in
Item Ledger Entry
It is not working.
It's actually solved through creating a function.