Hello NAV Experts,
I am having a hard time coming up with the right C/AL syntax to get what I need.
This report that needs to be broken down by location then item and then lot. This report base table is Item Ledger Entry.
The report needs to have a total for the sum of remaining quantity after it has displayed all of the lots for a corresponding item.
I already have the report done in the visual basic, but I cannot get it in the excel export.
I tried adding a decimal variable called "" and then on the Item Ledger Entry - OnAfterGetRecord trigger add the following code:
TotalByItems := CALCFIELDS("Item Ledger Entry"."Remaining Quantity")
I also tried: TotalByItems := "Item Ledger Entry".CALCFIELDS("Remaining Quantity")
However, nothing works !!!!
I have gotten the report get like the attached picture. This picture also shows how I need the report to look like.
I also attached a screenshot of my code.
I already tried following this:
https://saurav-nav.blogspot.com/2015/06/nav-2013-later-grouping-in-export-to.html
However, it does not make sense as this tutorial does not mention if it using functions, variables or what he named them. Very confusing for a beginner.
Again thank you for everything in advance.
Answers
Remaining Quantity in Item Ledger is not a flow field. So you should not be using CALCFIELDS.
You have to total the quantity as below :
TotalQuantity := TotalQuantity + ItemLedgerEntry."Remaining Quantity"
Alternatively you can use Inventory field in Item table.