简体   繁体   English

获取报表页脚水晶报表 c# 中每页的字段总和

[英]Get sum of fields per page in report footer crystal report c#

I calculated sum of fields per page by using this answer https://stackoverflow.com/a/33613632/12746914我使用这个答案https://stackoverflow.com/a/33613632/12746914计算了每页的字段总和

and I get the result as expected.我得到了预期的结果。 the following lines describe what the answer contains:以下几行描述了答案包含的内容:

ff_Reset_Total ff_Reset_Total

whileprintingrecords;
numbervar PageTotl;
PageTotl:=0;

ff_Current_Total ff_Current_Total

whileprintingrecords;
numbervar PageTotl;
PageTotl;

ff_Add_Record ff_Add_Record

whileprintingrecords;
numbervar PageTotl;
PageTotl:=PageTotl + {TheField};

then place these formula fields in the report as under:然后将这些公式字段放在报告中,如下所示:

ff_Reset_Total in Page Header Section ff_Current_Total in Page Footer Section ff_Add_Record in your Details Section ff_Reset_Total 在页面 Header 部分 ff_Current_Total 在页面页脚部分 ff_Add_Record 在您的详细信息部分

My problem is I want to print the total of each field per page in the report footer for example total of column X in page 1 = 5, a total of column X in page 2 = 10 so a total of total = 15我的问题是我想在报告页脚中打印每页每个字段的总数,例如第 1 页中 X 列的总数 = 5,第 2 页中 X 列的总数 = 10,所以总数 = 15

first I need to know the number of pages to pass it as variable to report footer, so this line total of column X on page 1 = 5 will be total of column X on page Y = 5 How can achieve this?首先我需要知道将它作为变量传递给报告页脚的页数,所以第 1 页上的 X 列的总行数 = 5 将是第 Y = 5 页上的 X 列的总和如何实现这一点? thanks in advance.提前致谢。 this image exactly what I want这张图正是我想要的

Modify your ff_Add_Record formula to include a new variable that can be used to accumulate the totals from each page.修改您的ff_Add_Record公式以包含一个新变量,该变量可用于累积每个页面的总数。

So your modified formula would look like this:因此,您修改后的公式如下所示:

ff_Add_Record ff_Add_Record

whileprintingrecords;
numbervar PageTotl;
numbervar GrandTotl;
PageTotl:=PageTotl + {TheField};
GrandTotl := GrandTotl + PageTotl;
PageTotl;

The last line will ensure this field displays the total for the page, while the GranTotl variable will continue to accumulate the page totals as they are printed.最后一行将确保该字段显示页面的总计,而 GranTotl 变量将在打印时继续累积页面总计。 Then you will need a new formula field to display the GrandTotl variable, which will look like this:然后您将需要一个新的公式字段来显示 GrandTotl 变量,如下所示:

ff_Print_GrandTotl ff_Print_GrandTotl

whileprintingrecords;
numbervar GrandTotl;

Place this new formula field in the Report Footer section and it should now show you the grand total across all pages.将这个新的公式字段放在报告页脚部分,它现在应该向您显示所有页面的总计。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM