Total quantity on excel export
            
                
                    martinher562                
                
                    Member Posts: 50                
            
                        
            
                    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.
                
                
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.
0                
            Best Answer
- 
            Hi,
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.5 
Answers
- 
            Hi,
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.5 - 
            Thank you @Sowkarthika !!! I spent a full day trying to figure this out. I appreciate the help. If you are ever in Los Angeles, CA. Let me know. we will go out to eat.0
 
Categories
- All Categories
 - 73 General
 - 73 Announcements
 - 66.6K Microsoft Dynamics NAV
 - 18.7K NAV Three Tier
 - 38.4K NAV/Navision Classic Client
 - 3.6K Navision Attain
 - 2.4K Navision Financials
 - 116 Navision DOS
 - 851 Navision e-Commerce
 - 1K NAV Tips & Tricks
 - 772 NAV Dutch speaking only
 - 617 NAV Courses, Exams & Certification
 - 2K Microsoft Dynamics-Other
 - 1.5K Dynamics AX
 - 323 Dynamics CRM
 - 111 Dynamics GP
 - 10 Dynamics SL
 - 1.5K Other
 - 990 SQL General
 - 383 SQL Performance
 - 34 SQL Tips & Tricks
 - 35 Design Patterns (General & Best Practices)
 - 1 Architectural Patterns
 - 10 Design Patterns
 - 5 Implementation Patterns
 - 53 3rd Party Products, Services & Events
 - 1.6K General
 - 1.1K General Chat
 - 1.6K Website
 - 83 Testing
 - 1.2K Download section
 - 23 How Tos section
 - 252 Feedback
 - 12 NAV TechDays 2013 Sessions
 - 13 NAV TechDays 2012 Sessions
 
