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

2 questions- dynamic page footers and creating a group for formatting 1

Status
Not open for further replies.

chrisdoesstuff

Technical User
Feb 24, 2011
20
US
I have two questions:

1. Can I create a formula for a page footer to display when it is not the second to last or last page in the report. I assume I can use the page n of m special field and calculate based on that but I'm not sure how to do that.

2. I have grouped my items based on a specific order. I would like to keep them together on a page. Is there a way to create a group that I can insert specific grouped values into in order to keep the other items together.

Items are grouped by name such as Each one is a group to remove duplicates. Can I instead of having 1-10 just falling where I put them can I group them and check keep group together?

Item #1
Color #1
Shape #1
Shape #1
Item Color #2
Color #2
Shape #2
Shape #2
 
Reply to Q1: you can identify the last page using OnLastRecord. The last-but-one page would be trickier. If you choose [Field Explorer] and [Special Fields] you should find [Total Page Count], but I suspect the software won't let you use it for section print control.

Crystal is written on the assumption that you chose the data and the software controls the printing. Processing occurs in fixed cycles and you have to work within it. It can be irritating but it is also the reason why it is so quick to write a report within Crystal's rules.

You might be able to do something with a running total and a summary total, each counting something that roughly corresponds to the number of lines printed. If you're not already familiar with Crystal's automated totals, see FAQ767-6524.


Reply to Q2: You can have a hierarchy of groups within groups, and any group can be given a [Keep Group Together] option that will mean it starts a new page if the entire group cannot be printed on the current page.

You can write a formula field that sets a Group Value, e.g.
Code:
 if "apple" or "orange" then "Fruit"
else if "Tomato" or "Cabbage" then "Vegetable"
else "Other"
All his is based on Crystal 11. It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.

It is also better to start two threads if you have two unrelated questions.


[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Thanks for your help and feedback. I'll give the group a try as it seems promising. For the other options I just used if pagenumber <> 1 then true else if pagenumber = totalpagecount -1 then true else false type logic to get the footers to display when I wanted them.

Again thank you for your help.
 
Ok I tried to create the group but it won't let me create the group. I assume that is because the data for grouping wouldn't exist until after it had run.

Do you have any other suggestions for creating this group?

Crystal 10.
 
You would create a formula in the field explorer like this:

if {table.food} in ["apple","orange"] then
"Fruit" else
if {table.food} in ["carrot","celery"] then
"Vegetable"

Place the formula in the detail section of the report and insert a group on it. Then go into the group expert and toggle it so it becomes your group #1.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top