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!

"look ahead" function

Status
Not open for further replies.

cglisc

Programmer
Nov 15, 2001
45
CY
Hello,

I need to print a field on page 1 of a report only if the total number of pages in the current group exceeds 5.

Is there a way to know while I am on page 1 the total number of pages in a group. To complicate matter more,
the page count is calculated using a formula and is not the standard group page count.

Thank you
Chris Lambrou
 
A summary count will give you the total number of detail records in the group. You'll have to make your own guess at how many pages that would be - data in Crystal will not 'pass upstream', and summary totals work only because they are known from the data and before printing starts.

To find where your current detail is, using a running total.

Right-click on a field and choose Insert to get a choice of Running Total, Summary and Grand Total. Or else use the Field Explorer, the icon that is a grid-like box.
It is also possible to get get totals using a Formula Field, which can contain a Variable or a Directly Calculated Total.

Running totals allow you to do clever things with grouping and formulas. They also accumulate for each line, hence the name. The disadvantage is that they are working out at the same time as the Crystal report formats the line. You cannot test for their values until after the details have been printed. You can show them in the group footer but not the group header, where they will be zero if you are resetting them for each group.

Summary totals are cruder, but are based directly on the data. This means that they can be shown in the header. They can also be used to sort groups, or to suppress them. Suppress a group if it has less than three members, say.

Grand totals are much like summary totals, but for the whole report rather than groups. Note that summary totals include an option to have a grand total calculated on the same basis.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
If you have the report set to "new page after" for the group footer and you also have "reset page number after" set, you could use a formula like:

if pagenumber = 1 and
totalpagecount > 5 then "My message" else ""

However, it sounds like you might not be using these settings in the section expert. Please provide your pagecount formula and explain why you are not using the built in functions.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top