This is a migrated thread and some comments may be shown as answers.

How to calculate aggregates on every page when have many columns

3 Answers 114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 01 May 2013, 02:29 PM
Hello telerik

According to your examples, you know the location of elements, their values and element count.
But when I create report, I don't know how many columns will be in my report. Usually 20-40 columns.
A piece of code: (I write by hand, to don't copy the entire code)

//by default standard portrait A4
private void BuilderReport(Telerik.Reporting.IReportDocument report)
{
    report.Width = new Unit(Columns.Count * 1.2, UnitType.Inch); // ≈ 20-25 Inch
 
    // ...
     
    foreach (var column in Columns)
    {
        var dataTextBox = new TextBox { /* Size, Location etc */ };
        report.Items["detail"].Items.Add(dataTextBox);
 
        // ...
        var footerTextBox = new TextBox { /* Size, Location etc */ };
        footerTextBox.Value = string.Format(@"=PageExec(""{0}"", Count(Fields.{0}))", column.Name);
 
        // pageFooter is Telerik.Reporting.PageFooterSection
        report.Items["pageFooter"].Items.Add(footerTextBox);
    }
}


Only each first page contains correctly aggregate values, other pages contsins 0
If replace PageFooterSection to Telerik.Reporting.GroupFooterSection all aggregate items is equals 0

How correctly calculate aggregates, when have too many columns and they are transferred on other pages?

Thanks

3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 01 May 2013, 04:32 PM
Hi Hans,

Please check the Data Functions help article elaborating on how to use PageExec function. The first parameter is the item name for which will be executed the accumulation.

I hope this helps.

Regards,
Stef
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Hans
Top achievements
Rank 1
answered on 02 May 2013, 06:38 AM
var dataTextBox = new TextBox { /* Size, Location etc */ Name = column.Name };
It is clear
Please, try to reproduce according to my code
I need help
0
Stef
Telerik team
answered on 07 May 2013, 11:21 AM
Hello Hans,

As stated in the mentioned help article:

"PageExec(itemName, aggregateFunction) - executes the specified aggregate function in the given scope. As the name suggests, it can be used in page header or page footer of the report. In order to specify the scope in which the aggregate would be evaluated, you need to specify a report item as a parameter of the function."

Since you add items manually to the report document and if we assume in Print preview the items do not gather on a single page and are transferred to another page, the Count accumulation in the PageExec function will return 0, as it is not on the page, which is the correct behavior. In case you need aggregates per group, you can use the RunningValue function.

I hope this helps.

Greetings,
Stef
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

Tags
General Discussions
Asked by
Hans
Top achievements
Rank 1
Answers by
Stef
Telerik team
Hans
Top achievements
Rank 1
Share this question
or