PageEnd event fires twice for the same page?

Posted by: gbetsos on 4 August 2017, 2:56 pm EST

  • Posted 4 August 2017, 2:56 pm EST

    I am relatively new to AR2 and trying to understand how its event mechanism
    works.


    In my report I have placed a text control, lblPageno, on the page footer with


    SummaryFunc = ddSFCount and
    SummaryType = ddSMPageCount,


    i.e. the control is set each time with the current page number.


    Inside ActiveReport_PageEnd() I have placed the following line of code


    MsgBox lblPageno.DataValue


    After executing the report I get:


    1
    2
    3
    4
    5
    5
    6
    7
    8
    9
    10
    11
    11


    My reports consists of only 10 (not 11) pages.


    I don't understand why the PageEnd event fires twice for page no. 5. Also,
    how is it possible that the event keeps on firing, even after the last page
    of the report (i.e. page number 10) has been reached.


     


     

  • Replied 4 August 2017, 2:56 pm EST

    The events and events sequence is explained in the following kb articles:

    INFO: Understanding ActiveReports' Events and Event Order Sequence

    http://www.datadynamics.com/forums/306/ShowPost.aspx


    INFO: Detail Section in Depth

    http://www.datadynamics.com/forums/93/ShowPost.aspx

    I think there is something missing in the information you provide as the lblPageno as specified doesn't produce the page numbers you list. Because you set the SummaryType to ddSMPageCount, you should get the number of pages on all the pages (10). Do you have the DataField set to some field? can you compress and post this report and we'll have a look.
  • Replied 4 August 2017, 2:56 pm EST

    lblPageno's properties are exactly as I described. I just omitted to quote that I have 
    also set SummaryRunning  to  2-ddSRAll.
    This gives the current page number.


    http://www.datadynamics.com/forums/8/ShowPost.aspx


    Anyway, I found out why PageEnd event was firing twice for the same page. The first
    time it was firing for a page that wasn't actually rendered at all!


    In my report I have two groups, say group1 and group2. The group order is
    group1 ->
    group2.


    The group footer of group1 has NewPage set to ddNPAfter whereas group footer of
    group2 has NewPage set to ddNPBeforeAfter.
    What I want to print is salaries of
    persons grouped BY group1, group2.


    Here is an example of a list of values I have in my data set:


    ID  Name   group1 group2 Salary


    1   Smith       A        X        1200$


    2   Brown       A        X        1100$


    3   Peterson   A        Y        1300$


    4   Floyd        A        Y        1200$


    5   Carrot       A        Y        1000$


    6   Parrot       B        X        1200$


    .... etc


    Persons with IDs 1,2 are printed on page no 1, persons with IDs 3, 4 and 5
    on page no 3. 
    Pages no 2 and 4 contain a summary report with subtotals (remember that group2 has NewPage set to ddNPBeforeAfter).


    Now rendering of page number 5 begins (due to NewPage = ddNPAfter of group1
    I guess), but nothing is rendered, not even a blank page. After record with ID = 6
    is reader PageStart fires once more and this time the details that follow are rendered
    on it.


     


     


     


     


     


     


     


     


     


     

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels