Page 1 of 2

SumRunning in DataBand: reset after change group

Posted: Mon Jun 25, 2012 12:50 pm
by Fabio Pagano
I need to have a SumRunning in the databand, the total must reset after change customer grouping.

Example:

Code: Select all

Customer 1
   Amount   SumRunning
   100         100
   5             105
   3             108

Customer 2
   Amount   SumRunning
   5             5
   8             13
   4             17
In this thread (year 2009):

http://forum.stimulsoft.com/Default.aspx?g=posts&t=2204

I've seen that i must create variables and manage them in the report code.

Is still this the correct way or in the meantime you have created some specific functionality?

I've found this other thread:

http://forum.stimulsoft.com/Default.aspx?g=posts&t=4900

but your proposed solution (in the screenshot of the above thread)

doesn't seem to work (SumRunning is not reset after change grouping).

Thank you.

SumRunning in DataBand: reset after change group

Posted: Mon Jun 25, 2012 12:59 pm
by Fabio Pagano
I've found this most recent thread:

http://forum.stimulsoft.com/Default.aspx?g=posts&t=3517

where the solution is:

"You can use the following code in events "After Print" DataBand(Master) component:
Code:
Text3_Sum.RunningTotal = false;
Text3_Sum.Init();"

Is there some solution without changing code?

Thank you.

SumRunning in DataBand: reset after change group

Posted: Wed Jun 27, 2012 3:30 am
by Alex K.
Hello,

On current moment, it is single simple solution for this task.

Thank you.

Re: SumRunning in DataBand: reset after change group

Posted: Mon Dec 10, 2012 7:01 pm
by Fabio Pagano
I've tried changing code behind, but didn't make it work. Recap: I have a group and a databand which contains a field with runningtotals ("{SumRunning(Solleciti.Importo)}"). I need that when group changes the runningtotal in the databand resets (see initial post for an example). In the sumrunning field (called "Text5") i have "{SumRunning(Solleciti.Importo)}" while in code i have written the following code:

Code: Select all

public void GroupHeaderBand1_AfterPrint(object sender, System.EventArgs e)
		{
			Text5_Sum.RunningTotal = false;
			Text5_Sum.Init();;
		}
Thank you.

Re: SumRunning in DataBand: reset after change group

Posted: Wed Dec 12, 2012 6:32 am
by HighAley
Hello.

We couldn't reproduce your issue.
Please, look at the attached report template.
Report.mrt
(19.05 KiB) Downloaded 488 times
If it will not help then send us your report template for analysis.

Thank you.

Re: SumRunning in DataBand: reset after change group

Posted: Wed Dec 12, 2012 12:53 pm
by Fabio Pagano
I have reproduced the problem in a report similar to your, you have only to change connection path. See report attached.

Thank you.

Re: SumRunning in DataBand: reset after change group

Posted: Thu Dec 13, 2012 9:57 am
by HighAley
Hello.

We didn't see any problem in this report.
You have just removed the code which reset the SumRunning value.

Thank you.

Re: SumRunning in DataBand: reset after change group

Posted: Thu Dec 13, 2012 3:15 pm
by Fabio Pagano
The code is in this position:

Image

I didn't put it in the region "StiReport Designer generated code - do not modify" because each time it's deleted by the autogenerated code.

Don't know if you were referring to some other code.

Thank you.

Re: SumRunning in DataBand: reset after change group

Posted: Fri Dec 14, 2012 5:56 am
by HighAley
Hello.

If you add this code on the code tab then you should add code that specifies the event handler to handle the event.
public Report() {
this.InitializeComponent();
this.GroupHeaderBand1.AfterPrint += new System.EventHandler(this.GroupHeaderBand1_AfterPrint);
}

public void GroupHeaderBand1_AfterPrint(object sender, System.EventArgs e)
{
Text4_Sum.RunningTotal = false;
Text4_Sum.Init();;
}
But it's better to add this code on the Design tab. Look at the attached image:
events.png
events.png (51.77 KiB) Viewed 5696 times
Thank you.

Re: SumRunning in DataBand: reset after change group

Posted: Fri Dec 14, 2012 7:47 am
by Fabio Pagano
It has worked.

I didn't know the "event editor" feature, great feature.

Thank you for your excellent and kind support.