Grid summary on each page

Stimulsoft Reports.WPF discussion
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Grid summary on each page

Post by HighAley »

Hello.

Then you could use array to store sum values.
Please, look at the code tab of the attached report template. There is a ColSum array added.
And you don't have to use complicated Conditions.

Thank you.
Attachments
Report.mrt
(22.65 KiB) Downloaded 500 times
Niqu
Posts: 81
Joined: Wed Aug 08, 2012 9:08 am

Re: Grid summary on each page

Post by Niqu »

Aleksey Andreyanov wrote:Hello.

Then you could use array to store sum values.
Please, look at the code tab of the attached report template. There is a ColSum array added.
And you don't have to use complicated Conditions.

Thank you.
It is another idea, but still I am not sure how can it help.
Of course this report do not work:
Small issue:
- Maybe I did not say it correctly - I want to sum correct items from dynamic list (sum of first element in dynamic lists, sum of second element in dynamic lists, etc.) - not items in column first, column second, etc., because i can have more items in dynamic list than column in databand. - But I think it is a small problem and it will be easy to change it to work correctly.
Big issue:
- Ok, I forgot to put on footerband properties "Print on all pages", so maybe you forgot that what I want it is summary on all pages. One summary on the end of raport it is easy to get, but I have no idea how I can get summary on all pages (sum of elements from the first pages, etc.)

Sorry if i am problematic. I spend a lot of time trying to make it work, but i failed. You know this library much better, so I thought that maybe you will have some idea how it can be done.

Thank you in advance for your help.
Attachments
Report_new.mrt
(19.47 KiB) Downloaded 429 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Grid summary on each page

Post by HighAley »

Hello.

In this case it's possible to do with scripts only.
We need some additional time to prepare an answer for you.

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Grid summary on each page

Post by Alex K. »

Hello,
Niqu wrote:You can see that your idea is wrong?
The solution for static list shows as example. We give only an advice how to solve the issue, but do not resolve it for you.
In this case, for dynamic list, you can use the additional hashtable or another object that is more convenient for you, in which save the sum by page and column:
Code in BeforePrint of Text3 :

Code: Select all

string pageColumn = "p" + PageNumber.ToString() + "c" + Column.ToString();
if (htColValues[pageColumn] == null)
    htColValues[pageColumn] = Clients.Qualities.Value;
else
    htColValues[pageColumn] = int.Parse(htColValues[pageColumn].ToString()) + Clients.Qualities.Value;
and expression in total text component:

Code: Select all

{htColValues["p" + PageNumber.ToString() + "c" + Column.ToString()]}
Please check modified report in attachment.
Thank you.
Attachments
Report_modified2.mrt
(23.22 KiB) Downloaded 282 times
Niqu
Posts: 81
Joined: Wed Aug 08, 2012 9:08 am

Re: Grid summary on each page

Post by Niqu »

Sorry, if you mistake me. I do not want you to solved my problem. I just want to same advice how can I do it, because all my idea that theoretically should work, do not work, because in your library not everything work fine. And that's why I asked you for some advice, because you know this library much better and you better know what is working, what is not and what eventually can help me solved my problem.

A lot thank you for your idea Aleksey. Perhaps this idea help me solved my problem or help solved the future problems.
Your report worked fine, so I a bit change it (I add, that "fotter" have to be on all pages), and I add some more rows, to have rows on 2 pages. Simple test.
And... it failed. Your idea is brilliant, but I think is something with rendering and the first row on the next page is suming to the previous page (of course I add sample project and sample report - it is the same project and report, but a bit modified).

As you can see, not everything is as colorful as we thought it will be.
I will think this problem and maybe I will find working solution to solved it.
Thank you for your help.
Attachments
StimulsoftWpfApplication4.zip
(4.56 MiB) Downloaded 415 times
Report_modified2.mrt
(17.96 KiB) Downloaded 372 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Grid summary on each page

Post by Alex K. »

Hello,

We need some additional time for check the issue.

Thank you.
Niqu
Posts: 81
Joined: Wed Aug 08, 2012 9:08 am

Re: Grid summary on each page

Post by Niqu »

I solved this problem moving this code from TextBox event, to method. It seems working.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Grid summary on each page

Post by Alex K. »

Hello,

Ok, thank you for letting us.
Let us know if you need any additional help.

Thank you.
Niqu
Posts: 81
Joined: Wed Aug 08, 2012 9:08 am

Re: Grid summary on each page

Post by Niqu »

Unfortunatelly I was happy too early. It do not work correct... It should be is some problem with parameter in function or in system variables - I don't know.
I have function

Code: Select all

SumValue(decimal value, int pageNumber, int column)
{ 
		if (!IsFirstPass)
		{
			string pageColumn = "p" + pageNumber.ToString() + "c" + column.ToString();
			if (!htColValues.ContainsKey(pageColumn))
				htColValues.Add(pageColumn, value);
			else
				htColValues[pageColumn] += value;
		}

		return value;
}
and it do not work correctly.
I also testing on function

Code: Select all

SumValue(decimal value, int pageNumber, int column)
{ 
		return value;
}
and it work the same - wrong.
I call this function by

Code: Select all

{SumValue(Clients.Qualities.Value, PageNumber, Column)}
When I call this function by

Code: Select all

{SumValue(Clients.Qualities.Value, 1, Column)}
- I put "1" instead of system variable "PageNumber" and this work correct.

I have no idea what can be the problem.

Of course I am sending you sample project (again the same one) and sample report.

Thank you for help in advance.
Attachments
Report_modified2.mrt
(17.87 KiB) Downloaded 519 times
StimulsoftWpfApplication.zip
(4.56 MiB) Downloaded 506 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Grid summary on each page

Post by Alex K. »

Hello,

Sorry, maybe we did not exactly understand your issue. Which values is incorrect?

Thank you.
Attachments
Capture.PNG
Capture.PNG (17.32 KiB) Viewed 5847 times
Post Reply