Calculating totals

Stimulsoft Reports.WPF discussion
Post Reply
kro
Posts: 27
Joined: Fri Oct 19, 2012 11:25 am

Calculating totals

Post by kro »

Hello

Some time ago I wrote about a problem with calculating totals on a data band - the use of SumIf() function increased the height of the text component that contained the expression. See: http://forum.stimulsoft.com/viewtopic.php?f=12&t=35907. In one of the posts I was advised to use Totals.Sum(). That solves the problem with growing text components.

Now I have a new problem. I have a data band and I calculate the sum of values in one column. I do this using both Sum() and Totals.Sum() and I get two different results. Totals.Sum() does not compute the sum correctly.

I attach a sample project that reproduces the issue. I am using version 2013.1.

I have two questions:
1) why is the result of the calculation incorrect?
2) what is really the difference between Sum() and Totals.Sum()?

All your help will be greatly appreciated.
Attachments
Report.mrt
(9.68 KiB) Downloaded 468 times
StimulsoftWpfApplication - totals.zip
(1.75 MiB) Downloaded 251 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Calculating totals

Post by HighAley »

Hello.

Sorry for delay with answer. We need some additional time.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Calculating totals

Post by HighAley »

Hello.

We have fixed your issue. The patch will be available in our next prerelease build on April 26.

Thank you.
kro
Posts: 27
Joined: Fri Oct 19, 2012 11:25 am

Re: Calculating totals

Post by kro »

Hello.

Thanks for the news.

I am glad the issue is fixed but I would still like to know the answer to my question: what is the difference between Sum() and Totals.Sum()?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Calculating totals

Post by Alex K. »

Hello,

The calculation totals in a report can be done by specifying an expression, for example, {Sum (DataBand1)}. These totals are calculated when rendering the report: each time when a single operation with the DataBand is done, a single value is calculated. All calculated values makes a total value, which will be displayed. In Stimulsoft Reports calculation of totals can be produced in another way - instantly. You should use the special Totals prefix. Calculation of totals occurs where the function is called, in contrast to standard results, calculations are performed while report rendering. Consider the calculation of totals in a report by the example of a report with grouping. Suppose there is a report with grouping.
http://admin.stimulsoft.com/Documentati ... sub=Totals

Thank you.
kro
Posts: 27
Joined: Fri Oct 19, 2012 11:25 am

Re: Calculating totals

Post by kro »

Thank you for your reply, now I know everything I wanted to know.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Calculating totals

Post by Alex K. »

Hello,

We are always glad to help you!
Let us know if you need any additional help.

Thank you.
Post Reply