Duplex and Total Page Count issue

Crystal 10 - Oracle db.

I'm having trouble correcting the 'total page count' of a report. This is necessary because I am conditionally adding an extra page to assist with duplex printing.

The report will be used to generate customer statements. I am grouping by the statement code, the customer account number and the statement month number. If a statement ends on an odd page I am conditionally showing a group footer section of the month number - which is large enough to create the extra page needed for duplex printing.

The problem is I don't want to count this extra page in the page count  total. How do I conditionally subtract 1 from the total page count of each statement whenever I show the extra page?


Who is Participating?
bdreed35Connect With a Mentor Commented:
I believe I was able to accomplish what you.
I will describe a report I just built using the Xtreme sample db, and then you can replicate it in your report.

Create a new report using the Orders table.
Group on Customer ID, place Order ID and Order Amount in the details section.
I resized the details section so I could get a group to span more than 1 page.
Open the Section Expert, click on Group Footer 1 and click Insert.
You should now have a Group Footer 1a and 1b sections.
Click on the parent Group Footer 1 section and set the property "Reset Page Number After"
Click on Group Footer 1a and click the X+2 button to the right of New Page After, then paste this logic there:

remainder(pagenumber,2) = 1

Save and CLose.
Click on Group Footer 1b and click the X+2 button to the right of New Page After and paste this logic there:

not onlastrecord

Save and Close.
then close the Section Expert.
Place the Page N Of M field in the Page Header section
The last thing to do is to suppress the Page N Of M field.
You will need to create 2 new formulas:

//@Set Suppress Flag to False - Place this formula in Group Header 1 and Suppress it
global booleanvar suppress_flag := false;

//@Set Suppress Flag to True - Place this formula into Group Footer 1a and Suppress it
global booleanvar suppress_flag;
if remainder(pagenumber,2) = 1
then suppress_flag := true;

Now, right click the Page N of M field, choose Format field.
Click the X+2 button to the right of Suppress, and paste this line there:

global booleanvar suppress_flag = true

Save and Close and Test it out.
Create this formula and use it to show the total number of pages - it'll subtract one from the total if it's an odd number:

if totalpagecount mod 2 = 1 then
  totalpagecount - 1
fkimonisAuthor Commented:
Hi frodoman,

That doesn't work because totalpagecount will always be even - having added the extra page to compensate for duplex printing.

BTW the  total page count is shown in the page header of report.

Any other suggestions would be greatly appreciated.

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.


Unfortunately I don't think you're going to be able to do this.  The problem is that your conditional suppression must take place during the WhilePrintingRecords phase which is also when any formula you create that uses TotalPageCount must also be evaluated.  The page header is going to be rendered before the group footer is so you're stuck.  I tried using a shared variable in the conditional suppression formula and tried forcing the page number formula in the page header to evaluate later but Crystal won't do it.

The only way I can think of to accomplish this is if you can find another way to handle the conditional suppression - something based on record count or the like that could be evaluated during the whilereadingrecords phase so there is time in the whileprintingrecords phase to do something with the information.

I agree.  SInce you add the page, it gets counted.

You might be able to set a flag in the section but I suspect it will be set too late to be useful.

Nice!  Very creative solution bdreed.

fkimonisAuthor Commented:

I followed the instructions and then moved the logic onto my statement report. The solution provided by bdreed35  has sorted out the page numbering issue, and added an extra page whenever the group ends on an odd number. :)

There is a slight problem with my summing up at group level. The total transaction amount needs to be displayed at the bottom of the last page where there are transactions.  - "print at bottom of page" on the group footer seems to add an extra page even if the statement ends on an even number.

Guys - I'm new to this - Do I accept the solution and open another follow up issue?


fkimonisAuthor Commented:

Managed to solve the totals issue!

I moved the total to the page footer and conditionally show it using both the suppress_flag and a new suppress_footer_flag. This new variable switches to 'false' in Group Header 1 and to 'true' in Group Footer 1b.

Thanks again to frodoman and bdreed35 for taking the time to help me with this issue. :)

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.