在水晶报告中获取每页的字段总和 [英] Get sum of a field per page in crystal report

查看:201
本文介绍了在水晶报告中获取每页的字段总和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个水晶报表,并获得如下字段的总和:

  Sum({TheField})

,我把它放在PageFooter部分在所有页面中都有,但如果报告有多个页面,



任何想法如何实现?

解决方案

您可以按如下方式获取页面级别总计。在报表设计中创建三个公式字段,即 ff_Reset_Total ff_Current_Total ff_Add_Record 并在公式编辑器中将其值设置为:


  1. ff_Reset_Total


    $ b b

      whileprintingrecords; 
    numbervar PageTotl;
    PageTotl:= 0;


  2. ff_Current_Total

      whileprintingrecords; 
    numbervar PageTotl;
    PageTotl;


  3. ff_Add_Record

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


现在将这些公式字段 部分




$ b


  1. ff_Reset_Total / li>
  2. ff_Current_Total 页脚部分

  3. ff_Add_Record



  4. 现在隐藏 ff_Reset_Total ff_Add_Record 右键单击标题和细节部分,指向格式字段,然后在 Common 标签选择抑制


    I Have a Crystal Report and get the sum of a field like this:

    Sum({TheField})
    

    and I put it in PageFooter section to have it in all pages but if the report has multiple pages it shows the sum of all fields and I need to get the sum per page.

    Any ideas how to do that?

    解决方案

    You can get page level totals as follows. Create three formula fields in report design, namely ff_Reset_Total, ff_Current_Total, ff_Add_Record and set their values in formula editor as under:

    1. ff_Reset_Total

      whileprintingrecords;
      numbervar PageTotl;
      PageTotl:=0;
      

    2. ff_Current_Total

      whileprintingrecords;
      numbervar PageTotl;
      PageTotl;
      

    3. ff_Add_Record

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

    Now place these formula fields in your report as under:

    1. ff_Reset_Total in Page Header Section
    2. ff_Current_Total in Page Footer Section
    3. ff_Add_Record in your Details Section

    Now hide ff_Reset_Total and ff_Add_Record by Right Click on each of them in Page Header and Details Sections, point to Format Field and then in the Common tab select Suppress

    这篇关于在水晶报告中获取每页的字段总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆