Total Page Number in Classic

lakshanvindanalakshanvindana Member Posts: 79
edited 2013-01-10 in NAV Three Tier
Hi guys,

I need to display "Page x of y" in Classic report.
y-> total pages

Please help me.

Thank you
Lakshan Kulawansa
ERP Consultant - MS Dynamics NAV
https://lk.linkedin.com/pub/lakshan-vindana-kulawansa/37/2a2/592

Comments

  • lakshanvindanalakshanvindana Member Posts: 79
    thank you Mohana

    my report is bit complex, with 6 data items & printing body on 3rd data item.
    wonder how to place the coding.
    try few ways, but not working.

    anyway thanks :)
    Lakshan Kulawansa
    ERP Consultant - MS Dynamics NAV
    https://lk.linkedin.com/pub/lakshan-vindana-kulawansa/37/2a2/592
  • David_CoxDavid_Cox Member Posts: 509
    Option 1: //Fixed Section Output
    If it can be done by counting the lines, if we know that the report will print 20 lines we could just add the dataitem counts together divide by 20 and round up.

    CAL Globals
    PageCount = Integer
    PageCount := ROUND((DataItem1.COUNT + DataItem2.COUNT + DataItem2.COUNT) /20, 1, '>') 
    

    Option 2: //Dynamics or Conditional Output
    If the report does not take a long time to run, what you could do is store the number of pages with a loop twice!

    Not tested just an Idea to work from!

    CAL Globals
    PageCount = Integer
    FirstRun = Boolean

    Add a new top level dataitem PageCounter - type - integer with no sections
    PageCounter - OnPreDataItem()
    FirstRun := NOT ISSERVICETIER;
    IF FirstRun THEN
      SETRANGE(Number,1,2)
    ELSE
      SETRANGE(Number,1);
    
    PageCounter - OnAfterGetRecord()
    IF Number = 2 THEN
      FirstRun := FALSE;
    

    Then in all Report Sections the last lines would read
    IF CurrReport.SHOWOUTPUT THEN
      CurrReport.SHOWOUTPUT(NOT FirstRun);
    

    In a new Report Footer Section get the last page number
    IF CurrReport.SHOWOUTPUT THEN
      PageCount := CurrReport.PAGENO;
    CurrReport.SHOWOUTPUT(FALSE);
    

    Option 3:
    Just tell the Customer that Dynamics NAV does not record the last page number, even in RTC if the report loops more than once!


    HTH

    David
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • lakshanvindanalakshanvindana Member Posts: 79
    thank you David

    issue is my report have group heading/footer (totals) in between pages.
    so do you think it is possible?

    I tried few things, those are working only for the reports which have printing FIXED NUMBER OF LINES (ex.20 lines per page).
    but in my case I cant predict/give the number of lines per page, it is very.
    Lakshan Kulawansa
    ERP Consultant - MS Dynamics NAV
    https://lk.linkedin.com/pub/lakshan-vindana-kulawansa/37/2a2/592
  • SogSog Member Posts: 1,023
    I tried few things, those are working only for the reports which have printing FIXED NUMBER OF LINES (ex.20 lines per page).
    but in my case I cant predict/give the number of lines per page, it is very.

    I hate to be the spoiler here, but is page x/y that important to your employer?
    This has been discussed many times, and this case is usually not worth the effort for the "problem".

    The most original solution I've come for this is printing to a word document and using word to determine the page x/y.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • lakshanvindanalakshanvindana Member Posts: 79
    yes, you are correct Sog.
    Thank you.
    Lakshan Kulawansa
    ERP Consultant - MS Dynamics NAV
    https://lk.linkedin.com/pub/lakshan-vindana-kulawansa/37/2a2/592
Sign In or Register to comment.