Print a different header depending on the page no.

AlishaAlisha Member Posts: 217
Hi,

I have a report that i need a different header depending on the page no., but i can't use pageno because this needs to be done for every different record on the headers, for example an Invoice that uses 2 pages to show all the lines, I want a different header in each page. Using PAGENO would work if I only print 1 invoice, but not if I print 2 invoices...

How can I do this?

Many thanks!

Comments

  • NagiNagi Member Posts: 151
    Hi,

    Have you tried using a TransHeader? Maybe that could help :-k
  • AlishaAlisha Member Posts: 217
    Yes, i've tried it but it does not work, for the transheader to work it has to belong to the dataitem that shows in more than one page, and that's not the dataitem that the header belongs too... lets say that the header is from "Sales Header", and the transheader should be from the "sales lines", but i cannot use it because it wouldn't be in the appropiate position in the report..

    Thanks for the idea though.
  • jlandeenjlandeen Member Posts: 524
    Thats not the easiest of report structures to get working but I find those kind of things can be done if you use an integer dataitem as a "master" or "parent" dataitem. Just have it set to show 1 record or apply a filter of:
    SETRANGE(NUMBER,1);
    

    Then insert 2 headers that have the "print on every page" property set to true. Then in the OnPreSection (check trigger name) of each of those header sections check if the current page number matches what you want to show and hide or show the section with:
    CURRREPORT.SHOWOUTPUT(true/false);
    

    Just rough idea of something to try.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • AlishaAlisha Member Posts: 217
    That does not work either, because if I print 2 invoices (each one with two pages), the page numbers would be 1,2,3,4, and I need one type of header in pages 1 and 3 (first page of every invoice) and the other type in pages 2 and 4 (rest of pages of every invoice).

    That solution would work if PAGENO would be reseted every new document no., but that's not how Navision works...
  • Revolution1210Revolution1210 Member Posts: 161
    The PAGENO is reset for each document no. - or should be at least!

    Do you want to print Header Type 1 for the first page of every invoice, then Header Type 2 for each subsequent page of that inoice?

    You can do this quite simply:

    Have two header sections in your report
    e.g. PageLoop, Header (1)
    PageLoop, header (2)

    Then control the visibility by placing this code OnPreSection() of PageLoop, Header(1):
    CurrReport.SHOWOUTPUT(CurrReport.PAGENO = 1);
    

    And this code OnInPreSection of PageLopp, Header(2):
    CurrReport.SHOWOUTPUT(CurrReport.PAGENO > 1);
    
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
  • AlishaAlisha Member Posts: 217
    Actually my report is not "Sales Header"/"Sales lines", but the main dataitem is Job, and then there are other dataitems below.

    However the PAGENO is not reset every new job no.... that's why I thought i didn't happen, but you are right, I've checked the Sales invoice, and in that case it is reset... do you know why it happens with one report and not the other? Is there any property to get this to work?

    Thanks a lot
  • Revolution1210Revolution1210 Member Posts: 161
    Alisha wrote:
    Actually my report is not "Sales Header"/"Sales lines", but the main dataitem is Job, and then there are other dataitems below.

    However the PAGENO is not reset every new job no.... that's why I thought i didn't happen, but you are right, I've checked the Sales invoice, and in that case it is reset... do you know why it happens with one report and not the other? Is there any property to get this to work?

    Thanks a lot

    The PAGENO is normally handled automatically by the report engine itself.

    Maybe you have some code in there which programatically handles page numbering? Is this a custom report or is it based on a standard NAV report?
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
  • AlishaAlisha Member Posts: 217
    No, there's no code messing with the PAGENO, I think it's a custom report (I didn't do it originally, I'm just modifying it!). The structure is this:

    Job
    Integer (for the header with Job data in everypage..)
    Extended Line Text
    Contact Budget
    Job Budget


    I need the job header in very page (different for pages >1), but it is not reset after every different job no...

    Any idea?
  • AlishaAlisha Member Posts: 217
    Mmmhh, I think the indentation of the dataitems didn't show properly :oops:

    Anycase, I solved the problem by reseting the PAGENO myself! (I think I should have thought of this before #-o #-o ).

    Thanks all for your help!!
Sign In or Register to comment.