Report - DataItem - sum calculation

andy76
Member Posts: 616
Good morning,
I have created a new report with 4 dataitem indented
Manufacturer -> Item -> Purch. Inv. Line -> Purch. Inv. Header
In Purch.Inv. Line footer I show the totals of quantity and amount grouped by Type,No.,Item Category Code and it is ok.
I Item Group footer section grouped by Item Category Code I would like to show the totals for Item Category Code.
I inserted code in trigger Purch. Inv. Line, Footer (2) - OnPostSection()
as following
gTotQuantityManufNameICC := gTotQuantityManufNameICC + "Purch. Inv. Line".Quantity;
gTotQuantityManufName := gTotQuantityManufName + "Purch. Inv. Line".Quantity;
gTotQuantityGeneral := gTotQuantityGeneral + "Purch. Inv. Line".Quantity;
but the totals are wrong.
I think that all lines of Purch. Inv. Line are summed and not only the one displayed in Purch. Inv. Line, Footer...
How can I solve?
Thank you
I have created a new report with 4 dataitem indented
Manufacturer -> Item -> Purch. Inv. Line -> Purch. Inv. Header
In Purch.Inv. Line footer I show the totals of quantity and amount grouped by Type,No.,Item Category Code and it is ok.
I Item Group footer section grouped by Item Category Code I would like to show the totals for Item Category Code.
I inserted code in trigger Purch. Inv. Line, Footer (2) - OnPostSection()
as following
gTotQuantityManufNameICC := gTotQuantityManufNameICC + "Purch. Inv. Line".Quantity;
gTotQuantityManufName := gTotQuantityManufName + "Purch. Inv. Line".Quantity;
gTotQuantityGeneral := gTotQuantityGeneral + "Purch. Inv. Line".Quantity;
but the totals are wrong.
I think that all lines of Purch. Inv. Line are summed and not only the one displayed in Purch. Inv. Line, Footer...
How can I solve?
Thank you
0
Comments
-
Similar problem happens if I insert the code to export in Excel in this section: Purch. Inv. Line, Footer (2) - OnPostSection()
I wrote the code to export in Excel but all Purch. Inv. Line are export and not only the ones displayed in footer section that I want.
Thank you0 -
If you maintain some totals manually then you will need to zero them somewhere.
In general I try to avoid maintaining totals manually because it gets complicated, especially if you are using TransHeader / TransFooter sections.
Have you tried putting the following code in the Item - OnPreDataItem trigger?CurrReport.CREATETOTALS("Purch. Inv. Line".Quantity);
0 -
Please read also my first reply to my message about export in excel.
If we solve this, probably solve also the first one.
Thank you very much0 -
When you maintain the sum through code, you will need to clear it somewhere, because it will keep adding up. Your sum will not differ between the screen output and excel. Th issue is that your sum is wrong.
I think you should try letting NAV calculate the sum. Otherwise you should clear the sum variables whenever the Item Category Code changes.andy76 wrote:I wrote the code to export in Excel but all Purch. Inv. Line are export and not only the ones displayed in footer section that I want.
You should use something like this:IF CurrReport.SHOWOUTPUT THEN BEGIN OutputToExcel(); END;
0 -
I already tried the:
IF CurrReport.SHOWOUTPUT THEN BEGIN
OutputToExcel();
END;
in section Purch. Inv. Line, Footer (2) - OnPostSection() but i report are printed 4-5 lines and in Excel 1729....how is it possible?????0 -
andy76 wrote:in section Purch. Inv. Line, Footer (2) - OnPostSection() but i report are printed 4-5 lines and in Excel 1729....how is it possible?????
To help on this I think we'll need to know how you have coded your report. In which places do you have an ExportToExcel call? What sections have you used?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
- 320 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