In Crystal Reports, How do I count all the rows in

2019-05-11 11:30发布

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?

2条回答
神经病院院长
2楼-- · 2019-05-11 11:45

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})
查看更多
Bombasti
3楼-- · 2019-05-11 11:47

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

查看更多
登录 后发表回答