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

Repeat group header on each page and initializing variables

Status
Not open for further replies.

maggiesda

Programmer
Jul 28, 2000
23
US
I have a group header and have set the option to 'Repeat group header on each page'. I also have a formula in this group header which initializes the group variables. Whenever I have a page change in the middle of a group the group variables are dutifully cleared. Now this seems to me a case of Crystal getting in its own way. But it's more likely that I've over looked something. Has anyone worked out a way to use 'Repeat group header on each page' and a formula to initialize variables without losing your amounts crossing over pages?

Thanks in advance.
 
You could create a boolean variable in the group header and set it to TRUE. Then, modify your reinitialization formula to reinitialize only when the boolean variable is FALSE.

Now, set the boolean variable to FALSE in the group footer and suppress the footer.

This way, you can repeat the header as much as you like, but the variables will only reinitialize if you've encountered a particular group's footer (which would have changed the boolean variable from TRUE to FALSE, thus triggering the reinitialization); otherwise, there is no reinitialization.

Try this and see if it works. In theory it makes sense, but give it a shot and see what happens.
 
Obviously, you'll want the reinitialization to happen first, before the boolean gets changed from FALSE to TRUE. This way, the new header is created, the variables get reinitialized, and then the boolean variable is changed from FALSE to TRUE -- which is where it will stay until the next header is created and the variables are reinitialized.
 
Many thanks. Over the weekend (I took Friday off), I read some more from George Peck's The Complete Reference: Seagate Crystal Reports 8 and found that there is a build in function called InRepeatedGroupHeader that deals with this issue. I'll take a close look at your solution also and see which will be easier to implement. It's great to have a solution; I'm delighted to have my choice of two solutions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top