Newbie need help, CurrReport.showoutput() raised error

andihp
andihp Member Posts: 7
Hi All,
I am totally new in Navision world, and being assigned to help development team to create some customized reports.
I have problem in one of my report, in the detail section, when the report runs statement of CurrReport.NewPage and follow by CurrReport.showoutput(false/true) at the same record, it will raised an error message "the called function can only be called from a Section Trigger".
How do I avoid / remedy this error message?
Any help would be very much appreciated.

TIA & Kind Regards
Andi.

Comments

  • Marije_Brummel
    Marije_Brummel Member, Moderators Design Patterns Posts: 4,262
    In the dataitem triggers you can only use CURRREPORT.SKIP to not use a record.

    To avoid showing a record in the sectiontriggers you can use CURRREPORT.SHOWOUTPUT.
  • andihp
    andihp Member Posts: 7
    Hi Mark,
    Thanks for your prompt reply.
    To avoid showing a record in the sectiontriggers you can use CURRREPORT.SHOWOUTPUT.

    That's what I intended to do exactly, but the problem is if CURRREPORT.SHOWOUTPUT runs after CURRREPORT.NEWPAGE statement then the error is raised.
    Why the currreport.newpage is causing the currreport.showoutput to be malfunctioned.

    I put both statement in the body section trigger.

    TIA
    Andi
  • andihp
    andihp Member Posts: 7
    the code as follows:

    IF (intCount>8) THEN
    IF ((intRow MOD 8)=0) THEN
    CurrReport.NEWPAGE; =======> the currreprt.newpage was executed.

    IF ("G/L Account No."='10110010') AND (Debit1=0) THEN
    BEGIN
    tbGEVat.RESET;
    tbGEVat.SETFILTER("Document No.","Document No.");
    tbGEVat.SETFILTER("G/L Account No.","G/L Account No.");
    IF tbGEVat.FIND('-') THEN
    REPEAT
    Debit1:=Debit1+tbGEVat."Debit Amount";
    UNTIL tbGEVat.NEXT=0;

    CurrReport.SHOWOUTPUT(FALSE); ====> this raised error.

    END
  • kine
    kine Member Posts: 12,562
    In which trigger is your code placed? CurrReport.SHOWOUTPUT can be just in OnPreSection or in OnPostSection...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • andihp
    andihp Member Posts: 7
    kine wrote:
    In which trigger is your code placed? CurrReport.SHOWOUTPUT can be just in OnPreSection or in OnPostSection...

    Hi,
    I put the code in OnPreSection of Body section trigger.
  • kine
    kine Member Posts: 12,562
    If it is true, than it must run without problem :-)

    Shall you export the object into text and copy&paste the whole trigger from the text file here (with the name of the trigger etc...)?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.