Page 1 of 2

SumRunning problem

Posted: Tue Jun 16, 2009 1:20 am
by mrafieian
I use {SumRunning(DataBandName, MyDataSource.AmountColumn)} but I want to reset this sum to zero when group is change and recalculate the sum in new group as this sample

A(Group)
Column1 SumRunning(Column1)
1 1
2 3
3 6
4 10
5 15

B(Group)
Column1 SumRunning(Column1)
8 8
7 15
3 18
4 22
5 27

Please help me.

SumRunning problem

Posted: Thu Jun 18, 2009 3:04 am
by Andrew
Hello,

Sum does not work in groups. You need to use the variables. You may read about it in our documentation http://stimulsoft.com/Documentation.aspx .

Thank you.

SumRunning problem

Posted: Tue Jun 23, 2009 6:53 am
by mrafieian
Helo

Thank you for your reply , can you give me more detail about what kind of variable I should use for this perpose?

Thanks

SumRunning problem

Posted: Tue Jun 23, 2009 7:02 am
by Jan
Hello,


====================

Using Stimulsoft Reports you may make calculation of aggregate functions in the code of events of a report. This allows calculating aggregate functions with complex logic or condition. Another advantage of Stimulsoft Reports is that, when calculating, you call the value to be calculated from the report code and make changes. If you want to make such a calculation, the variable which stores the value of an aggregate function is required. For this, you should create a new variable in the data dictionary.

Important! Using variables from the code to store the result of an aggregate function calculation is not allowed. It is necessary to use variables created in the dictionary.


Here you specify the type of a variable, for example Decimal, and the initial value is zero. Then in the Render event of the Data band you should set the code for a variable increment. For example, if you want to calculate the sum of variables of the Products.ItemsInStock field then the code will be as follows:


MyTotals += Products.ItemsInStock;


The RenderingEvent event

The Data band in what the RenderingEvent event calculation will be made

The code for calculating the sum



For calling the variable, that contains the value of a total, write in the following in the text expression:


{MyTotal}


If, after you have written the text expression, you run the report rendering. Then, when the report rendering will reach the component which contains the expression with the total variable, then there will be an output of this variable. Therefore, you should specify to the report generator that the component output must be done right after the whole report rendering - when the variable will be calculated completely. For this, you must set the ProcessAtEnd property of the text component to true.

Notice. Expressions of text components which the ProcessAtEnd properties are set to true are always calculated at the end of the report rendering.

As was written before the total will be calculated and shown in the proper part of a report.

====================

Thank you.

SumRunning problem

Posted: Wed Jun 24, 2009 2:23 am
by mrafieian
Helo,

Thanks a lot for your support , It's very usefull

Regards

SumRunning problem

Posted: Mon Aug 03, 2009 4:42 am
by AAA
Jan wrote:Hello,


====================

Using Stimulsoft Reports you may make calculation of aggregate functions in the code of events of a report. This allows calculating aggregate functions with complex logic or condition. Another advantage of Stimulsoft Reports is that, when calculating, you call the value to be calculated from the report code and make changes. If you want to make such a calculation, the variable which stores the value of an aggregate function is required. For this, you should create a new variable in the data dictionary.

Important! Using variables from the code to store the result of an aggregate function calculation is not allowed. It is necessary to use variables created in the dictionary.


Here you specify the type of a variable, for example Decimal, and the initial value is zero. Then in the Render event of the Data band you should set the code for a variable increment. For example, if you want to calculate the sum of variables of the Products.ItemsInStock field then the code will be as follows:


MyTotals += Products.ItemsInStock;


The RenderingEvent event

The Data band in what the RenderingEvent event calculation will be made

The code for calculating the sum



For calling the variable, that contains the value of a total, write in the following in the text expression:


{MyTotal}


If, after you have written the text expression, you run the report rendering. Then, when the report rendering will reach the component which contains the expression with the total variable, then there will be an output of this variable. Therefore, you should specify to the report generator that the component output must be done right after the whole report rendering - when the variable will be calculated completely. For this, you must set the ProcessAtEnd property of the text component to true.

Notice. Expressions of text components which the ProcessAtEnd properties are set to true are always calculated at the end of the report rendering.

As was written before the total will be calculated and shown in the proper part of a report.

====================

Thank you.
Can you give me 1 simple example?
i having problem when access Text SumRunning from code behind C#. Because i want read number to word from Text SumRunning.
Example: Text SumRunning after calculate is 300000000. How to access number 300000000 from code behind C#
Thanks

SumRunning problem

Posted: Mon Aug 03, 2009 6:10 pm
by Edward
Hi

There is no such a problem to access a value which had been already rendered, as you can use a variable from Dictionary. So value of this variable is unchanged for every rendered databand row.

Please see the report in the attachment.


Thank you.

SumRunning problem

Posted: Mon Aug 03, 2009 9:05 pm
by AAA
Thanks Edward, but hoow to access variable MyVariable from Code Behind?
When i access variable MyVariable is emtpy
Code i used:
rpt.Dictionary.Variables["MyVariable"].Value

This is example (attach). How to access value txtTotalPrice after calculate

SumRunning problem

Posted: Tue Aug 04, 2009 4:43 am
by AAA
i want convert totalprice decimal to word same function ToCurrencyWords in Stimusoft report
but i need convert to Vietnam language.

SumRunning problem

Posted: Tue Aug 04, 2009 12:31 pm
by Jan
Hello,
khongminh9 wrote:Thanks Edward, but hoow to access variable MyVariable from Code Behind?
When i access variable MyVariable is emtpy
Code i used:
rpt.Dictionary.Variables["MyVariable"].Value

This is example (attach). How to access value txtTotalPrice after calculate
You can use following code:

Code: Select all

rpt["MyVariable"]
Thank you.