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

Print Subreport Right After Main Report 2

Status
Not open for further replies.

Dominican1979

IS-IT--Management
Apr 30, 2008
108
US
Hello Everyone,

Thank you for reading my post. So basically I a report that is an invoice report listing product details such as product number, description, quantity, price, amount, and totals on the report footer. That works great. On this main report, I have some information on the page footer that needs to be there on every page.

Now I need to create a subreport based on this invoice report that will be a commercial invoice to send internationally. I inserted the subreport on a new section report footer #2 below the main report footer. However, the subreport prints out right after the main report without page break and also the page footer is printed on it.

I would like the subreport to pretty much be its own entity even though its part of this main report. By this I mean that when I run this report, the main report will print all its components page header/footer, report header/footer and then following that, the subreport would print on the next page with its own page header/footer, report header/footer whitout any of the components from the main report being printed on it and by this i mean the page footer that prints on the main report on every page.


I'm sorry that this post is so long, but this is just driving me nuts, I know there's gotta be a way, I've tried a bunch of things on my own without luck, and google hasn't been much help. Thank you in advance for all your help. I have provided a link to a screenshot of the report in design mode.


Crystal Reports XI Release 2
SQL Server 2008
 
First, go into the section expert->report footer_b->check "New page before". If the subreport will only take one page, you can suppress the page footer with:

pagenumber = totalpagecount

Or you could suppress the page footer with:

onlastrecord

...except this would suppress the page footer if there is only one record on the last page of the main report.

Another method is to create two formulas like this:

//false:
whileprintingrecords;
booleanvar flag := false;

//false to be placed in the report header and suppressed:
whileprintingrecords;
booleanvar flag := false;

//true to be placed in the report footer_b and suppressed:
whileprintingrecords;
booleanvar flag := true;

Then in the section expert->page footer->suppress->x+2, enter:

whileprintingrecords;
booleanvar flag;
flag = true; //note no colon

-LB
 
Hello lbass

Wow thank you for such a fast response, I already left work and don't have my computer with me but I will try this first thing on Monday and I will let you know how it goes, thanks a lot!
 
hello lbass,

Thanks again for your reply. So I tried creating the formulas exactly as you mentioned above. I didn't do it the other way you mentioned because the subreport may be 1 or multiple pages.

This is what I did to make sure I'm following you correctly:

* I created a formula called true that reads like this:

Whileprintingrecords;
booleanvar flag := true;

I placed this one on the report footer and suppressed

* Another one called False that reads like this:

Whileprintingrecords;
booleanvar flag := false;

I placed this one on the report header and suppressed

* On the section expert ->page footer -> suppress -> x+2, I entered:

Whileprintingrecords;
booleanvar flag;
flag = true (without semicolon)


I then ran the report and this is what I got:

*The page page footer on the last page of the main report does not show.

*The subreport doesn't show at all


Any idea what could be wrong?


 
Sorry, I had an extra formula in there.

The following formula belongs in the report footer_b section that contains your subreport:

Whileprintingrecords;
booleanvar flag := true;

You should have report footer_b formatted to "New page before".

Then you can use the same suppression formula for both the page header and page footer on the page containing the subreport, assuming there is no section after RF_b.

None of this should have affected the display of the subreport, however. You should probably check the section expert and make sure you didn't accidentally add the conditional suppression formula on the RF_b section or something.

-LB
 
Hello lbass,

You are going to hate me, but I think I'm lost. So I basically started back on square one with an unedited report just like the one I started with, without any of the formulas or anything, just the subreport on it as part of the main report. I created this formula:

Whileprintingrecords;
booleanvar flag := true;

and put it on the RF_b (the section that contains my subreport on the main report). I went into section expert, checked the box that says new page before and then clicked x+2 and put the formula in there. I then went into section expert and selected page header, checkd the box to suppress, then clicked x+2 and pasted the same formula in there, also did the same for the page footer.

When I run the report, no page header or footer is printed on any page at all. I then removed the formula for the page header and footer just to see, and they print on every page even on the subreport.

I'm gonna try to describe my report briefly again maybe I didn't do a very good job initially:

***MAIN REPORT***

Report Header
Page Header a
Page header b
Group Header #1
Details
Group Footer #1
Report Footer a
Report Footer b (where my sub report lives)
Page Footer (This has to print for every single page on the main report even the last page)


***SUB-REPORT***

Report Header
Page Header
Group Header #1
Details
Group Footer #1
Report Footer
Page Footer


So basically what I need to have is the main report print entirely first, with all its sections includding its own page header/footer on every single page, then after that on the next new page, the sub-report will print, with its own components, page header/footer, etc, without having any sections from the main report print on any of the pages on the sub-report.


Again thank you sooo much for your help, I've followed your advice a few times before without any issues, but maybe this time I'm just not understanding correctly. Thanks a lot!





 
No, I mean for you to create {@false} and {@true} in the field explorer->formula area. Then place them directly on the areas I mentioned. Then go into the section expert only for the suppression formula. To reiterate:

//false to be placed in the report header and suppressed:
whileprintingrecords;
booleanvar flag := false;

//true to be placed in the report footer_b and suppressed:
whileprintingrecords;
booleanvar flag := true;

Then in the section expert->page footer->suppress->x+2, enter:
whileprintingrecords;
booleanvar flag;
flag = true; //note no colon

-LB
 
Hello lbass,

I finally did it correctly following your advice and works great. I just have one final question. I noticed the subreport has no page header/footer, and I need to print page N of N just like im doing on the main report, how could I do that? Again thanks a million for all your help, I greatly appreciate it.
 
Subs don't have page footers or page headers. I think you should add a page footer_b section to the main report and format PF_b to suppress (for the first part of the report) in the section expert by using:

whileprintingrecords;
booleanvar flag;
flag = false //note no colon

Then add Page N of M to this footer also.

-LB
 
Thanks a lot for all your help lbass, I really appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top