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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute formula only when group changes 3

Status
Not open for further replies.

zemp

Programmer
Jan 27, 2002
3,301
0
0
CA
CR XI

I have a report in which I have a formula to increment a shared variable in the GH1. GH1 is set to repeat on each page.

I would like my formula to ecexute only when GH1 changes and not every time GH1 prints.

Is there a way to achieve this?

zemp
 
Try:

whileprintingrecords;
numbervar MyNumber;
If previous({table.groupedbyfield}) <> {table.groupedbyfield} then
MyNumber:=MyNumber+1;
MyNumber

-k
 
Or you could use the function: inrepeatedgroupheader, as in:

whileprintingrecords;
numbervar MyNumber;
If not inrepeatedgroupheader then
MyNumber:=MyNumber+1;
MyNumber

-LB
 
Crystal provides a nice special expression for this (InRepeatedGroupHeader). Using this expression, here's an alternative approach:
Code:
whileprintingrecords;
shared numbervar MyNumber;
If Not InRepeatedGroupHeader then
MyNumber:=MyNumber+1;
MyNumber
- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Oops, yes, that should be "shared numbervar".

-LB
 
Thanks again, that did the trick.

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top