[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 958
  • Last Modified:

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?

Thanks

Frixos
0
fkimonis
Asked:
fkimonis
1 Solution
 
frodomanCommented:
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
else
  totalpagecount;
0
 
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.

Frixos
0
 
frodomanCommented:
Gotcha.

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.

frodoman
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
mlmccCommented:
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.

mlmcc
0
 
bdreed35Commented:
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
WhilePrintingRecords;
global booleanvar suppress_flag := false;

//@Set Suppress Flag to True - Place this formula into Group Footer 1a and Suppress it
WhilePrintingRecords;
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.
0
 
frodomanCommented:
Nice!  Very creative solution bdreed.

frodoman
0
 
fkimonisAuthor Commented:
Excellent!

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?

Frixos

 
0
 
fkimonisAuthor Commented:
Hi,

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. :)

Frixos
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now