In Crystal Reports, How do I count all the rows in the Details section and place that count in the header?

北慕城南 提交于 2019-12-21 20:26:05

问题


I've tried adding a new formula and used this code:

whileprintingrecords;
numbervar x;
x := x + 1;

Problem is, if I place the formula that displays the count on the header section, it only shows the first value since it hasn't yet incremented.

I need a total count of the rows in every page and just show it in the header. how do I do this?

Wait I just realized it is placed in a group not in the details section. Let me revise my question. How do I get the value of the display formula in the last page of the report? Makes sense?


回答1:


The simplest way to get a total count of all the rows within the report and place it in the page header is to create a new formula, with the value:

Count ({Table.Value})

and place it in your page header (where Table.Value is a field in your dataset).

EDIT: To get a total count of all the groups, change the formula to:

DistinctCount ({Table.GroupField})



回答2:


Right-click on any field in Details section, Insert Summary, select Count(), drag resulting field into page (report, group) header.



来源:https://stackoverflow.com/questions/8697022/in-crystal-reports-how-do-i-count-all-the-rows-in-the-details-section-and-place

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!