Solved

Page number on Crystal subreport?

Posted on 2010-09-21
27
2,450 Views
Last Modified: 2012-05-10
I have a Crystal Reports 8.5 report with a subreport.  The subreport may be more than 1 page long.  I want to number the subreport pages only (1 of 2, 2 of 2), but there is no Page Header/Page Footer option on the subreport.  Any ideas?
0
Comment
Question by:MariaHalt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 13
  • 9
  • 5
27 Comments
 
LVL 14

Expert Comment

by:LinInDenver
ID: 33730991
As far as I know, this is not possible, since the sub report can be inserted into a main report at any point. The sub report doesn't really know what page it is on, which is why you'll notice there is no page header or page footer.

Have you considered placing the page number on the main report? Depending on where you place the sub report inside the main report, you can do section formatting to reset page number after certain sections, and some other options. You can conditionally suppress the page numbers on main if certain conditions are met... Maybe play around with that a little.

Possibly you can use a shared variable containing the page number and pass it to the sub report... this could work using the reset page number after section.

hope this helps.
0
 

Author Comment

by:MariaHalt
ID: 33733774
Let me explain further...The main report is a one page letter.  I don't want to number that.  The subreport is an attachment that can be more than one page long.  I wanted to number the subreport only.  
0
 
LVL 14

Expert Comment

by:LinInDenver
ID: 33735363
Hi Maria,

Then you can try some of the approaches I mentioned above. Most likely, you can try having two sections in your report, with the letter being in section 1.
reset page number after the end of the letter section.
Place PageNumber in your main page footer.
suppress PageNumber OnFirstRecord.
I believe the outcome would be no page number displayed on the first page, and then Pages 1,2,3 etc. on following pages.
0
Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

 

Author Comment

by:MariaHalt
ID: 33736586
LinInDenver:  I've followed your suggestion and I got it working ALMOST exactly like I want, I just need to suppress the page number on the main report (since it's  a letter)...how can it identify when I'm on the main report?

Letter (1 page, do not want to show page number) + Attachment 1 (1 page, will display page 1 of 1) + Attachment 2 (variable pages, will display page 1 of n) and repeat for next letter, etc...

I appreciate your help!
0
 
LVL 14

Expert Comment

by:LinInDenver
ID: 33736668
Hey Maria,

The below worked for me, on a Page N of M field sitting in the Page footer of my Main Report:

Right Click on Page Number choose Format Field
Common Tab
Click X-2 for Suppress (leave the box unchecked).

if RecordNumber = 1
then yes else no
0
 

Author Comment

by:MariaHalt
ID: 33736812
I have a group...how can I say on New Group Number, suppress page number?
0
 
LVL 14

Expert Comment

by:LinInDenver
ID: 33736892
Well there is GroupNumber, which tells you which group you are on. Maybe you can use that somehow?

If GroupNumber = 1 then yes else no <---would suppress on the first grouping returned, and display it for all other groups in the report.
0
 

Author Comment

by:MariaHalt
ID: 33736929
Each group is a new letter...

1st Group:  Letter (do not want page number) + Attachment 1 (page 1 of 1) + Attachment 2 (page 1 of n)
2nd Group:  Letter (do not want page number)  + Attachment 1 (page 1 of 1) + Attachment 2  (page 1 of n)
3rd Group:  Letter (do not want page number)  + Attachment 1 (page 1 of 1) + Attachment 2  (page 1 of n)
etc..
0
 
LVL 14

Expert Comment

by:LinInDenver
ID: 33737082
Hey Maria - are you able to publish the report? It will be easier for me to try a couple of things.

From File, choose Save Data with Report, Save it again. That will give me some data so I can see what's happening.
0
 

Author Comment

by:MariaHalt
ID: 33737117
I can't it's sensitive stuff and I don't have time to makeup stuff to put in it.  Thanks anyway, you pointed me in the right direction.  I'll figure it eventually.
0
 
LVL 14

Expert Comment

by:LinInDenver
ID: 33737153
okay. it sounds like you are very close.

if you change your mind, an easy way to fake out sensitive things like names, SSNs, etc. is to replace the fields/formulas with different text  'John Doe' as a formula instead of {table.name}.

Lin
0
 
LVL 14

Expert Comment

by:LinInDenver
ID: 33737224
I just got one thing to work... this will work as long as the attachments are always at least 2 pages.

reset page number after section containing letter.
drop PageNofM on page footer.
right click to format field, and in the suppress X2, try this formula.
if PageNofM = 'Page 1 of 1'
then yes else no

This will not work if the attachments can ever only contain 1 page...
0
 

Author Comment

by:MariaHalt
ID: 33737979
The attachments are conditionally suppressed as well.

Group A:  Letter (1 page only) + First Conditional Attachment (if visible, it's one page) + Second Conditional Attachment (if visible, pages can vary)

Group B:  Letter (1 page only) + First Conditional Attachment (if visible, it's one page) + Second Conditional Attachment (if visible, pages can vary)

Group C:  Letter (1 page only) + First Conditional Attachment (if visible, it's one page) + Second Conditional Attachment (if visible, pages can vary)

etc...

How can I conditionally suppress the page number on the letter page?  The letter is the main report.
0
 
LVL 14

Expert Comment

by:LinInDenver
ID: 33738092
Humm... is there anything on the letters that are consistent?
I.e.: If there is a field on your letters that contains the word LETTER, or HELLO, you could maybe work that into your conditional suppress..

If {table.field} like '*HELLO*' then yes else no.

does that make sense?
0
 

Author Comment

by:MariaHalt
ID: 33739277
Yes, but the subreports are in the group footer, wouldn't they see it?
0
 
LVL 14

Expert Comment

by:LinInDenver
ID: 33739356
Hi Maria - I'm not sure. I think you just need to experiment and see what happens. You'll have to get crafty, but I bet you can find a way to conditionally suppress it.

unfortunately, i think I've run out of ideas, but I think you are really close to solving this issue!
0
 

Author Comment

by:MariaHalt
ID: 33747706
mlmcc!!!  Thank you so much for your comment...I checked it out...unfortunately it won't work for me.  My second subreport has a grouping and the details can vary from one record to hundreds.  I spoke to the department head and they have accepted they're not going to have any page numbers :(

Seems like someone else should have come across this problem at some point.  All I want to do is suppress the page number on the letter page (first page per group).

Group A:  Letter (1 page only, no page number necessary) + First Conditional Subreport in Group Footer A  (if visible, it's one page) + Second Conditional Subreport in Group Footer B (if visible, pages can vary)

Group B:  Letter (1 page only, no page number necessary) + First Conditional Subreport in Group Footer A (if visible, it's one page) + Second Conditional Subreport in Group Footer B (if visible, pages can vary)

Group C:  Letter (1 page only, no page number necessary) + First Conditional Subreport in Group Footer A  (if visible, it's one page) + Second Conditional Subreport in Group Footer B (if visible, pages can vary)
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 33750715
Can you upload just the report (no saved data) or does it include sensitive fields?

There should be a way to use the section expert to reset page numbers and suppress the page numbers

mlmcc
0
 

Author Comment

by:MariaHalt
ID: 33755841
OK...I cleared out a bunch of stuff.  I'm resetting the page number in Details l, Group Footer #1a and Group Footer #1b.  Thank you!
mh-uga-new-accept-letter-test.rpt
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 33759266
Try this.

It is difficult to tell what you need without data.

mlmcc
mh-uga-new-accept-letter-testRev.rpt
0
 

Author Comment

by:MariaHalt
ID: 33761974
mlmcc:  Sorry to keep pestering you, but I can't open it (I have CR8.5).  Can you describe what you did?  Again, sorry.
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 33762077
I don't remember what I did.

Try this idea

In Group Header 1B add a formula
WhilePrintingRecords;
Global BooleanVar SuppressPageNumber;
SuppressPageNumber := True;
""

In the report header
WhilePrintingRecords;
Global BooleanVar SuppressPageNumber := True;
""

COnditionally suppress PFc with
WhilePrintingRecords;
Global BooleanVar SuppressPageNumber;
SuppressPageNumber

In GF1A adda formula
WhilePrintingRecords;
Global BooleanVar SuppressPageNumber;
SuppressPageNumber := False;
""

mlmcc

0
 

Author Comment

by:MariaHalt
ID: 33763431
When you say

In the report header
WhilePrintingRecords;
Global BooleanVar SuppressPageNumber := True;

1.  do you mean on the main report?
2.  is it a formula or a condition?

Thanks for your help :)
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 33766728
It is a formula that you put in the report header.

mlmcc
0
 

Author Comment

by:MariaHalt
ID: 33770442
mlmcc:  YOU ROCK!!!  It's perfect.  And it makes soooo much sense.  THANK YOU INFINITELY!!!
0
 

Author Closing Comment

by:MariaHalt
ID: 33770446
mlmcc ROCKS!!!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question