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

Repeating a page footer when there are no group headers or footers

Status
Not open for further replies.

Dond12

Technical User
May 3, 2001
57
US
I had to employ the following technique to get SCR to repeat info about a record on subsequent pages (when the record in question ran for more than a single page). I don't know if this is the right way to do it, but it works:

In the Details section, RECORD ONE contains the name of an organization and some additional info. RECORD ONE normally only occupies slightly less than a page -- but in some cases, RECORD ONE runs to a second page (or even a third page). RECORD TWO always starts on a new page, so you never have a record beginning near the bottom of a page.

When RECORD ONE extends to a second (or third) page, I want to have the name of the organization appear in small type at the bottom of all of the subsequent pages. Here's what I did:

First, I created a string variable called @FOOTER_NAME, simply declaring it:

shared stringVar footer_name ;

Next, I created a formula called @switch_footer with the following statements:

whileprintingrecords ;
if({xxx.ORG_NAME} <> shared stringVar footer_name) then
shared booleanVar switch_footer := TRUE ;
shared stringVAr footer_name := {xxx.ORG_NAME} ;

I put this formula in the DETAILS section alonside the actual field {xxx.ORG_NAME} and suppressed it.

Next, I created a page footer that contained the string variable @FOOTER_NAME and then specified that the footer should be suppressed if @switch_footer = TRUE

(at this point, the footer would never be displayed, because @switch_footer would always be TRUE)

Finally, I created a second page footer (below the first page footer) and inserted a formula called @switch_back. This formula contained the following statement:

whileprintingrecords ;
shared booleanVar switch_footer := FALSE ;

I suppressed this second page footer.


Now, when I run the report, the variable FOOTER_NAME will not show on the first page (i.e., the one that contains the actual organization name at the top), but it will show on every subsequent page, until a new organization name is listed (at which point @switch_footer will change from FALSE to TRUE).

Did I do too much, or is this the right way to proceed? I am curious because, even though it seems to work just fine, I may be using variations on this technique in the future, so I would like to know at this stage whether or not I should be doing something else.
 
I am pretty sure that your first formula is completely irrelevant. You declare a variable at the beginning of any formula that uses it. So you don't need to keep repeating &quot;Shared XXXvar&quot; every time you use the variable. Just at the beginning of the formula, once. It could be even simpler, but I would need to know more about the report:

You say the second 'record' starts on a new page. Which of the sections has the &quot;New Page&quot; checkmark checked? Details?

What are the group and sort fields in this report?


Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
thanks for the advice. There are no groups; that's the point. When I say &quot;record,&quot; I may be using somewht archaic terminology. By &quot;record,&quot; I mean a collection of fields. The information is listed, roughly, as follows:

ID Number Name of Organization
City, State
Rating

Description [long memo field]

Reader's Comments [long memo field]

-----page break----

ID Number Name of Organization
(etc.)

The point I was making was that the first group of fields (the first &quot;record&quot;) may go on for two, or even three, pages. If that happens, I want the reader to be able to identify which &quot;record&quot; he is reading by adding a footer on the second (and third) page of a &quot;record&quot; showing the name of the organization.

Obviously, you don't need the name of the organization in the footer of the first page, because the name of the organization appears as the first line of text. But, on subsequent pages (i.e., until the next &quot;record&quot;) you DO need the footer (or at least my readers -- with short attention spans (!) do).

Acting on your advice, I will do some trimming when I get to the office on Monday.

Thanks again.
 
Your terminology is correct. I have learned in this forum not to assume that people use the correct terms. Also, nothing prevents you from using groups with only one record per group. This sometimes makes things more flexible than sorting.

I would split the detail section into several pieces and the page footer into at least 2. Put a field in DetailsA that sets the variable telling a second formula to suppress. Put the second formula on PageFooterA, then in page footer B have a formula that flips the variable to allow things to print. It will last until the beginning of the next record. Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top