Doublepass and scripting variables

I have a report set to doublepass=true to print "Page X of Y" on a page footer

I also accumulate a running total in a variable.

I set the variable to zero in the onreportprint event but it looks like it only fires at the start of the first pass of the report thus accumulating in both first passes of the report.

Where should I initialize these variables to avoid the "double counting"

If the first pass did not count as printing then the onreportprint event would fire after the first pass ie at the start of the printing pass...

Thanks

Comments

  • G'day Tony,

    FWIW our Reports do something similar to your outlined approach (all Two-passes; all have Page Footer with "Page X of Y" on them; most have some sort of "running totals in variables").

    We have tried to standardise the approach so do a lot of stuff in a Report Template and a "Commons" Unit.

    And what this comes down to is that we tend to do the management of Variables only in one of the Passes. You can test via <Report>.Engine,FinalPass Property which of the two is executing (one of our "Common" routines translates this into a "FirstPass" Function for clarity).

    It is not much of an improvement for "efficiency" but it does make debugging easier 😉

    So for example calculating the Total Page Count is done in the "FirstPass", Calculating the Running Total(s) is done in the FinalPass.

    Depending on your "architecture" / "house style" this might work for you too,..

    Cheers, Paul

  • Hi Paul

    In the sea of documentation I missed the finalpass property (sitting there to deal with my exact dilemma).

    Appreciate your reply

    Cheers

    Tony

  • 😎

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.