Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"whileprintingrecords" clarification.

Status
Not open for further replies.

Xprogrammer

Programmer
Oct 12, 2002
14
US
I have a formula field with contents as

whileprintingrecords;
numbervar counter1;
counter1:=counter1 + 1

When it encounters a change in group headers, it still counts! Isn't it to count only records? if it counts group headers, how could one modify the formula to not include group headers? Thank you in advance.
 
The number of times a formula "counts" depends on where it is placed in the report, and what the evaluation time is (whileprintingrecords, whilereadingrecords, etc).
Try moving the formula out of the header. Malcolm
 
If the formula is placed BOTH in details section and in the GH sectin then it will end up counting both details and headers. This sounds like what you have. The formula shouldn't be in both places.

WhilePrintingRecords doesn't affect the frequency of accumulation. It tells Crystal to wait until the records are grouped and sorted and to process the formula as the report is going to the printer. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Further clarification: Using CR 8, I have an additional formula field defined in the report header as
whileprintingrecords;
numbervar counter1:=0;
Basically, it initializes counter1

The formula defined in the earlier posting as
whileprintingrecords;
numbervar counter1;
counter1:=counter1 + 1

is placed in the topmost detail section as there are multiple detail sections that are conditionally suppressed as a function of input variables.

There are two group headers before the detail section.
 
Suppressing a section does not affect the execution of a variable assigment. The inherent frequency of the section that contains formula determines the execution.

So, this variable will increment for every detail, once per record, regardless of which detail sections happen to print.

You could add a condition to the assignment formula that matches your suppression formula (or is the opposite) to only accumulate records that print this section. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top