Problem with sum function

Stimulsoft Reports.NET discussion
Post Reply
italital
Posts: 4
Joined: Tue May 06, 2014 7:52 am

Problem with sum function

Post by italital »

Hi,

I've got a problem with sum function for a field inside a page. In my scenario I set the DataBand property CanBreak to true, in order to eventually split the DataBand in more than a page. But I have a case (see the example) in which the sum is not correct because the second field to sum is inside my first page and its DataBand finishes in the second page, so the field is not considered in the sum calculation of the first page but it is included in the sum calculation of the second page.

There is a way to calculate the sum of two field in a page even if the DataBand of the second record finishes in the second page?

I attach a report with data as an example.

Thank you
Fabio Magnani
Attachments
Report.xml
Data
(419 Bytes) Downloaded 160 times
Report.mrt
Report
(9.21 KiB) Downloaded 150 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Problem with sum function

Post by HighAley »

Hello.

You Sum column on the DataBand1. The sum is calculated on that page, where the band is finished its rendering.

As a way you could calculate sum manually in a variable. Don't forget to set the Process At property of the text component on the page footer to EndOfPage.
Report.mrt
(10.36 KiB) Downloaded 183 times
Than you.
italital
Posts: 4
Joined: Tue May 06, 2014 7:52 am

Re: Problem with sum function

Post by italital »

Hello,

thanks for the reply.

Your solution solves the case I described in the previous request, but if you move the "Test.Price" field near to End DataBand text, and doing that, the field moves to the second page, then your solution still sum the two values. In fact, the second field is visible into the second page, but its value is still calculated on the first page.

I attach a report with data as an example.

Fabio Magnani
Attachments
Report.mrt
Report
(10.76 KiB) Downloaded 150 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Problem with sum function

Post by HighAley »

Hello.

Sorry it was my fault. Please use After Print event of the Data Band instead of the Text component.
Report(3).mrt
(10.72 KiB) Downloaded 164 times
Thank you.
italital
Posts: 4
Joined: Tue May 06, 2014 7:52 am

Re: Problem with sum function

Post by italital »

Hello,

thanks for the reply.

Your last solution solves the case I described in the second post but still does not solve the first post.

Fabio Magnani
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Problem with sum function

Post by HighAley »

Hello.

We need some additional time to prepare answer for you.

Thank you.
italital
Posts: 4
Joined: Tue May 06, 2014 7:52 am

Re: Problem with sum function

Post by italital »

Hello,

thanks for the reply.

I will be waiting for your reply.

Fabio Magnani
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Problem with sum function

Post by HighAley »

Hello.

Usually the band has single line of text component and this problem does not occurs.
We have created your another solution.
You should use code from the End Render event of the report from the attached report template.
Set also Tag property of the text component that you summing.

Thank you.
Attachments
Report.mrt
(10.28 KiB) Downloaded 251 times
Post Reply