Sub-total each page of report

kevin.7710kevin.7710 Member Posts: 40
I am a beginner for Navision, I need your help, Now I meet some trouble for design the report. I want to design a report for invoice. The table source is sales header and sales line. I want to sum the field of “Sales line.Line amount” for each page . I use the section type is transfooter. But the last page is not sum. If I add a section type is footer. Then I sum the “Sales line.Line Amount”. The result is all of pages sum. Please help me how to solve the problem? Thanks!

Comments

  • kinekine Member Posts: 12,562
    You went in good direction - transfooter for summing at end of pages which will continue, footer at the end of whole report. From your description I am not able to understand where you have problem (or what is the problem).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kevin.7710kevin.7710 Member Posts: 40
    I use transfooter,but at the end page it didn't sum ,so I create footer to try.
    I want to sum "Sales line.line amount" at the end page but not whole pages
  • kinekine Member Posts: 12,562
    You need to create the Transfooter for correct DataItem (dataitem which is active in time when pagebreak is done). Sometime it is needed to add the integer dataitem to have correct footers. See some standard report using transfooters - e.g. Report 206 (see PageLoop dataitem).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kevin.7710kevin.7710 Member Posts: 40
    Let me clarify where I have problem - My goal is to show on each page the total price of the records that are shown on the same page, and on that page alone (not including the subtotal of the previous pages).
  • Miklos_HollenderMiklos_Hollender Member Posts: 1,598
    Ah! That's an interesting task. I think I did it once but I'm not sure about all the details, but here are some clues.

    - forget the automatic sums, sum stuff up in variables i.e. having a decimal variables, increasing it in OnAfterGetRecord

    - basically you want to clear the variable after it's displayed on one page, so it starts from zero on the second page. If I remember correctly my solution was something like that that when it's displayed, in the OnPreSection of the transfooter I set a boolean TotalDisplayed variable to true. Then in the OnAfterGetRecord if it's true, then set it back to false and clear the decimal variable. It is before adding the current line to it. Not 100% sure it works perfectly but the general idea is this and then you can try to refine it. If it doesn't seem to work right another thing that worked with a similar requirement is having two decimals, TotalAmount and TotalAmountToDisplay and the second one got assigned the from the first one in some trigger and it helped but I don't remember the details either.
  • kinekine Member Posts: 12,562
    It's easy - you just needs to store the values from last transfooter and subtract the values in next transfooter. Or better one - add TransHeader, store the values into some variables, and in transfooter just subtract them from the whole sum.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kevin.7710kevin.7710 Member Posts: 40
    Thanks to give me some ideas.
Sign In or Register to comment.