4

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?

Kurusu
  • 197
  • 3
  • 4
  • 11
  • "just show it in the header" - which header - the page header, the group header or the report header? –  Jan 02 '12 at 12:35
  • @MarkBannister Page Header. What happens is, when I use the formula to display the count and place it in the page header in the first page it always shows '1' then on only on the next page does it show the incremented value. I need it to show the total value in the header section in the first page – Kurusu Jan 03 '12 at 01:31

3 Answers3

11

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})
  • 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? – Kurusu Jan 04 '12 at 03:26
  • "Makes sense?" No. Are you trying to get a count of the total number of groups in the report, and put it in the header of every page? –  Jan 04 '12 at 07:20
4

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

Arvo
  • 10,349
  • 1
  • 31
  • 34
  • For a report header/footer, this will be the total for the whole report, and for a group header/footer, this will be the total for the group. You can't add summaries to page headers/footers in this way, although you can do so through a formula item. –  Jan 04 '12 at 07:16
  • Well, I misread original posting a bit, sorry :( Displaying count of rows for current page in page header is tricky even using formula - first-pass formulas do not know about layout, second-pass formulas can't look forward either. – Arvo Jan 04 '12 at 08:33
  • Quite so, but as I understand it, the user wants the summary value for the whole report, not just the current page. –  Jan 04 '12 at 08:43
  • Hmm, I can't understand anything now. It is almost impossible to find count of records (or groups) in current page, but it is much simpler find count of records (or groups) over entire report. My weak english refuses to understand "I need a total count of the rows in every page" in one and only way :( – Arvo Jan 04 '12 at 11:56
  • Perhaps Kurusu could enlighten us? –  Jan 04 '12 at 12:05
1

I just summarized the field with Count and put it to Group Header That's It.

Shaiwal Tripathi
  • 497
  • 4
  • 16