Big problem: BeforePrintEvent occurs twice in GroupFooterBand!

Stimulsoft Reports.NET discussion
Post Reply
casic
Posts: 68
Joined: Thu Jan 18, 2007 4:25 pm
Location: Germany

Big problem: BeforePrintEvent occurs twice in GroupFooterBand!

Post by casic »

Hi there,

I use the BeforePrintEvent of a GroupFooterBand to calculate sums (group sums and also total sums). Unfortunately this event always occurs twice! The same event in the GroupHeaderBand works right and occurs only once. Same behaviour with the AfterPrintEvent.

Here is a sample report (using NWIND.MDB) to reproduce this behaviour:

Code: Select all


  
    
      
        Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Programme\Stimulsoft\StimulReport.Net\Bin\NWIND.MDB;Persist Security Info=False
        Verbindung
      
    
    
      
        Customers
        
          CustomerID,System.String
          CompanyName,System.String
          ContactName,System.String
          ContactTitle,System.String
          Address,System.String
          City,System.String
          Region,System.String
          PostalCode,System.String
          Country,System.String
          Phone,System.String
          Fax,System.String
        
        30
        Verbindung
        
        Customers
        
        SELECT TOP 5 * FROM Customers
      
    
    
    
    
  
  
  
    
      None;Black;2;Solid;False;4;Black
      Transparent
      
        
          MessageBox.Show("Header");
          Transparent
          0,0.4,19,0.8
          
            
              Transparent
              0,0,6.8,0.6
              
              Arial,14,Bold
              0,0,0,0
              Text3
              
              
              {Customers.City}
              Black
              
            
          
          {Customers.City}
          
          Top
          GroupHeaderBand1
          
          
        
        
          Transparent
          0,2,19,0.8
          
            
              Transparent
              0,0,8.6,0.8
              
              Arial,8
              0,0,0,0
              Text1
              
              
              {Customers.CompanyName}
              Black
              
            
            
              Transparent
              9.6,0,7.8,0.8
              
              Arial,8
              0,0,0,0
              Text2
              
              
              {Customers.City}
              Black
              
            
          
          
          
          Customers
          Top
          
          DataBand1
          
          
          
        
        
          MessageBox.Show("Footer");
          Transparent
          0,3.6,19,0.8
          
          
          Top
          GroupFooterBand1
          
          
        
      
      
      b7085fe25c134cb39963cdea3ad2c0e2
      1,1,1,1
      Page1
      
      29.7
      21
      
      
        Arial,100
        [50:0:0:0]
      
    
  
  
  
    System.Dll
    System.Drawing.Dll
    System.Windows.Forms.Dll
    System.Data.Dll
    System.Xml.Dll
    Stimulsoft.Controls.Dll
    Stimulsoft.Base.Dll
    Stimulsoft.Report.Dll
  
  Report
  1/27/2007 1:50:33 PM
  1/27/2007 1:38:02 PM
  c2d60e6e74aa4814b4a93efd90b9bd22
  Report
  Centimeters
  2007.1
  using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.ReportControls;
using Stimulsoft.Report.Components;

namespace Reports
{
    
    public class Report : Stimulsoft.Report.StiReport
    {
        
        public Report()
        {
            this.InitializeComponent();
        }
        #region StiReport Designer generated code - do not modify#endregion StiReport Designer generated code - do not modify
    }
}
  CSharp
  
Hope this issue can be solved quickly,

Thank you very much for your support,

Markus
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Big problem: BeforePrintEvent occurs twice in GroupFooterBand!

Post by Vital »

BeforePrintEvent and AfterPrintEvent can occurs more then once on each row. It occurs each time when band does not fitted on one page and report engine render this band on new page again. In this case you need use RenderingEvent. For calculation totals you need use variables declared in report dictionary.

Thank you.
casic
Posts: 68
Joined: Thu Jan 18, 2007 4:25 pm
Location: Germany

Big problem: BeforePrintEvent occurs twice in GroupFooterBand!

Post by casic »

Sorry, I think this is a missunderstanding:

I use the BeforePrintEvent to calc (and round) the group sum and store the result in a variable (declared in the report dictionary). Then I add the result to a total variable (also declared in the report dictionary). This is neccessary because the group sum is rounded. This would work fine if the BeforePrintEvent will be fired only once for each group footer (I know that there could be more event raises if I set the property "PrintOnAllPages" to true - but this is NOT the case!). I added the simple report only to show you, that the BeforePrintEvent is always raised twice. I think the current behaviour is not correct.

Can you solve this issue please - I can't continue my migration work so long, because I need the correct behaviour in many reports.

Thank you very much for your support,

Markus
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Big problem: BeforePrintEvent occurs twice in GroupFooterBand!

Post by Vital »

Please send your report with your calculation to support [at] stimulsoft [dot] com.

Thank you.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Big problem: BeforePrintEvent occurs twice in GroupFooterBand!

Post by Vital »

Please send your report with calculation of totals to support[at]stimulsoft[dot]com.

Thank you.
Post Reply