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

GH does'nt repeat if no more details lines

Status
Not open for further replies.

leishad

Technical User
Apr 3, 2003
88
US
My report is an invoice - the Group Header should function like a page header and the group footer contains the invoice totals. When there is not enough room for the group footer on the page it prints on the next page, but if there are no more details the Group Header doesn't repeat with it. As long as details are present the GH repeats as expected. How can I get it to repeat when there are no details but there is still a GF.

(I have used the Change Group Expert to select Repeat and Keep together for the GH)
 
This is dependent upon your Crystal version, which you omitted, along with everything else about your environment.

The basic problem is that the group header isn't a page header, so once you no longer have details, the group header has completed.

Perhaps you should be using a Page Header, it will always display.

Or you might add in another page header section (right click and select insert section below) and use something like the following to handle suppression except if there aren't any more rows:

not(onlastrecord)

And then for the group header suppress using

onlastrecord

Place the same fields in the new page header section as are in the group header.

-k
 
This is dependent upon your Crystal version, which you omitted, along with everything else about your environment.

The basic problem is that the group header isn't a page header, so once you no longer have details, the group header has completed.

Perhaps you should be using a Page Header, it will always display.

Or you might add in another page header section (right click and select insert section below) and use something like the following to handle suppression except if there aren't any more rows:

not(onlastrecord)

And then for the group header suppress using

onlastrecord

Place the same fields in the new page header section as are in the group header.

-k
 
I am using Crystal 8.5. I do not know of any other relavant environmental details to share.

I cannot use PageHeader, I was merely trying to illustrate the type of behaviour I wanted.

Given this, is there a way to cause the GH to repeat when no details are present.

 
A group header doesn't exist when there aren't details...

You might create a faux group outside the current group and have it's group header suppressed except at Onlastrecord, and have the current group header not print Onlastrecord.

Example data, expected output, and why you feel a page header can't do this would be interesting information.

A common mistake when posting is force aa design on the experts here, you're probably better served to describe the environment and the requirements and see what they offer.

-k
 
My Report--------------------------------------------
Page Header : company logo
GroupHeader1A: Invoice#, Order#, Date, CutomerName, Address1
GroupHeader1b: Address2 (supress if blank)
GroupHeader1c: Address3, Salesperson, PO#, DetailColumnHeadings
DetailsA: Qty, ItemDesc1, Price, ExtendedPrice
DetailsB: ItemDesc2 (supress if blank)
Detailsc: Subreport (line item comments) Supress is blank
GroupFooter1A: InvoiceTotal, TaxTotal (these are not summary fields)
GroupFooter1b: Comments2 (Supress if blank)
GroupFooter1c: Comments3 (Supress if blank)
Page Footer: miscellaneous text

---------------------------------------------

The problem here is that I am very young to Crystal Reports therefore I do not know enough to realize the complexity a pro user would see in my question. As I had spent several hours looking for my own way to address this I just wanted to be sure I wasn't missing something obvious (like, 'just push this button'). I see that I wasn't missing anything...the answer is "no, there are other things you can do but the GH will not repeat if there are no more details".

Regarding my environment,please educate me on what I should provide Crystal8.5, Windows2000, SQLServer ????

Now, regarding other things I can do, because I am learning Crystal I don't want to tweek to many things as I can easily end up in a mess....you know...one fix creates a need for another fix.. (For example, I did try to insert my GH as a subreport into the pageheader but found that what was printing in the pageheader was (1) record off of what printed in the report -- I am too inexperienced to figure out how to address this).

I think (in my limited experience) the simplest approach would be if I could count the #of lines in the detail section and limit the # per page so that there is always room for the footer to appear. This way either it will fit on page one or there will be additional detail to go to page 2 therefore ensuring the reprint of the GH as well as the GF. Can you tell me, if straight forward, how to make the statement and where to place it. If I am again asking too much or not providing enough then please disregard.
 
Try postiung example data and expected output, what doesn't work, and what you think might also work isn't as important as what you have.

Is the report header you speak of the GH1, or?

Basic information about your data and intent should do it.

I still don't understand why a Page Header won't work, it would only print at the end if there was a group footer but no details, which is probably what you want.

Again, right click the page header and select insert section below.

Copy whatever is in the Group Header 1 into the new page header section.

Right click the new page header section and select format section->X 2 next to suppress and place

not(onlastrecord)

Right click the original group header 1 and select format section->X 2 next to suppress and enter:

onlastrecord

Now the new page header will only print if the report is on the lastrecord, and the group header 1 will not print. This should also handle the instance where the last row is on a page by itself.

If this doesn't help, please demonstrate the data and expectations.

-k
 
Although I think SV's solution should work, just a couple of comments:

I guess another question is why you want a group header if there are no details. You could add the group header info into the group footer--then if there are not details and the group footer is orphaned, it can stand alone without the group header. If there are details, it might not hurt to reiterate the group header info in the group footer anyway (although it depends on what you have in the group header!).

You also might try going to report->change group options->options and check "Keep Group Together." I think this will force the report to attempt to prevent orphaned footers, although it can result in extra white space in other places.

-LB
 
SV - I see your point, so I'll start over with a problem statement:


Problem: The footer is occasionally orphaned, depending on # of detail lines printed (all else works fine)

Related Settings:
Have selected KeepTogether/Repeat on Group Header
Have selected Print at Bottom/KEEPTOGETHER/new page after for Group Footer

Report Purpose:
to print daily batches of invoices to mail to customer

Data:
The incoming data is for MULTIPLE invoices

Restrictions:
layout so addressing will show in envelope window
repeat addressing and invoice specific info on each page of invoice
new page at each change in invoice#

Visual: a fairly standard invoice. Letterhead in page header, Customer addressing info and other invoice# specific info as well as the headings for the details section are in the group header(abc as outlined previously), the detail section (abc as outlined previously) contains a list of the items ordered and pricing data, the group footer contains the totals
which are pulled from the incoming data (not summarized).
 
You wrote :

I think (in my limited experience) the simplest approach would be if I could count the #of lines in the detail section and limit the # per page so that there is always room for the footer to appear. This way either it will fit on page one or there will be additional detail to go to page 2 therefore ensuring the reprint of the GH as well as the GF. Can you tell me, if straight forward, how to make the statement and where to place it. If I am again asking too much or not providing enough then please disregard.

Translation :

What you need is to put subtotals in a page footer (you can create a new instance of the page footer) as a group footer will only print at the end of the group and not a the bottom of each page.

solution :

If this new page footer section has the same height as your group footer and a suppress formula like onLastRecord you have two cases :
You are'nt on the last record and there will be a group header on the next page
You are on the last record, the page footer will be suppressed, leaving room for the group footer which has the same height!

django
bug exterminator
tips'n tricks addict
 
I was unclear from your response whether you have "Keep Group Together" checked--this is different from "Keep together" on the Group Header, which only keeps the section together. "Keep Group Together" will try to keep all sections within a group together--header, details, footer--and is found in report->change group expert->options (also available when you first setup the group). It would surprise me if you were still getting orphaned footers if you have this checked.

-LB
 
IBass,

if you check keep group together, as the group is the invoice, if the size is too large it will not improve as anyway, the whole group wo'nt fit on a single page, and maybe you'll have a blank page syndrom before the oversized group

django
bug exterminator
tips'n tricks addict
 
I mentioned earlier that white space could result, but I don't think a whole page would necessarily appear (although this might happen on the first page if the report header is not suppressed). I don't think Leishad is requiring that an invoice stay on one page, and I'm guessing that "New Page After" is checked for the invoice group, so that if the invoice goes to two pages, there will be white space. The issue is to avoid an orphaned footer, and I think "Keep Group Together" will prevent that. I'm not saying it would work 100%, but in looking at a report here designed with a new page after each group, and with keep group together on, the group header repeated on every page, and there were no orphaned footers on a 100-page report--a pretty good rate of success, in fact, 100% (in this case).

-LB
 
lbass - I DO have the group keep group together checked (SURPRISE :)) in the Group Expert. Dang, I do however appreciate the clarification -- I was wondering what was up with that.

After laying out the fields in the report I did my first preview and saw that if you do nothing you just get a running list, no separation between invoices. So I set the New page after group footer so that I have individual invoices (ex. invoice1(2pgs) invoice2(1pg) invoice 3(3pgs)etc). This worked perfectly. Then I saw that I wanted my "invoice totals"(fields pulled from data) to print at the bottom of the page, not just whereever the detail ended. So I selected Print group footer at the bottom of the page. Around the same time I also saw that I didn't want any of my sections breaking so I selected 'keep together for each section'. At this point is when I became aware that the group footer was occasionally ending up by itself on the last page of invoice. This is when I went to the Group Expert and picked 'keep group together'and 'repeat on each page' -- nothing changed.

I think I just need to start over - maybe I've ended up with conflicting settings after all the trial and error.

Thank-you
 
After trying it again, I was able to create an orphaned group footer, so I think that "Keep Group Together" doesn't work 100% of the time, but I don't think you need to redo your report. I think you were on the right track earlier.

Create a running total {#cntwingrp} using the running total editor. Select a recurring field, count, evaluate for each record, reset on change of group. Place this on your report, and note the value of the rt when you have an orphaned group footer. Let's say that this happens at record # 25 within the group. Then go to format->section->details->"New Page After"->x+2 and enter:

remainder({#cntwingrp},24) = 0

Keep the page break on the group footer as is.

Now you will get one detail on the second page, along with the repeating group header.

-LB
 
I believe I have your answer, at least, Business Objects does. Check out article C2004981 on the "old" crystal decisions web-site. It is called "Creating group header for orphaned group footers."

 
Thank-you all for your assistance. I tried Pauls article reference and it worked like a charm and took 5 minutes to implement. lbass - I'll be hanging onto the 'detail count' solution as I know I will be able to use it(or silmilar) elsewhere in the future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top