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

Report Layout: Sub reports spanning multiple pages

Status
Not open for further replies.

krishna

Programmer
Mar 30, 2000
121
0
0
IN
Hi

I am using Crystal 9. I have a main report which is laid out in the portrait mode.

I have 2 sub reports in the main report which are placed in the same section. The report apperas side by side.

My problem is that if one report spans to the second page and the other report fits in the first page itself, then I want to print "Please refer to the Previous page" in the first report's place.

Thanks in advance.


Regards
KK
 
Tricky. I think you could do it by writing some sort of page-based count. The basic format for such things is:

Code:
Place V_head in the Page Header section and suppress it
//   Clear the total
WhilePrintingRecords;
NumberVar PageTot :=0;

Place V_Item in the whichever section contains the field you want to total
// Accumulate
WhilePrintingRecords;
NumberVar PageTot := PageTot + 1;

Place V_Show in the page footer section
// Show
WhilePrintingRecords;
NumberVar PageTot;
In your case, you're relying on something returned by a subreport shared variable, which cannot be used until the section below the section containing the subreport. Doing it that way, you would need a message that was suppressed unless the second report was missing.

You'll need to experiment.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Hi Madawc Williams

I assume you are asking me to place the message in the section that is just below the section containing sub report. In that case the message will appear only after the sub reports which is not what I wanted. I would like to print at the same line where the second report began in the new page. Some thing like the following

Report1heading Report2heading
Please refer to the previous page Col1 Col2 Col3



Hope this is clear.

Thanks in advance.

Regards
Krishna Kumar
 
I don't think that's possible in Crystal. You can get something like the effect using the method I suggested.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
I think Madawc was on the right track, but I think I would try creating a formula that counts records within the subreport:

Whileprintingrecords;
shared numbervar linecnt := linecnt + 1;

Add this formula into each subreport section that is displayed: group header, details, group footer. Do not reset the formula within the subreport. Note the line count where the subreport continues to the next page. Then in the main report, create a formula:

whileprintingrecords;
shared numbervar linecnt;

if linecnt < 45 then "Please refer to the previous page" else ""
//where 45 is the number of records that will fit on one page

You'd have to experiment with the placement of this formula within the section.

-LB
 
Oops. The formula would need to be a section inserted below the one in which the subreport is located, but you can format the section containing the subreport to "Underlay following sections."

-LB

 
Hi

Thank you for the response. I think I need to explain a little more about the report so as to find out whether there are any alternative ways other than using 2 sub reports.
I need a report which compares the investments of a person with the investment proposed by the system. Lets call the existing investment as Current Investment and proposed the investment as Recommended Investment.

The report will group the investment by type( Stocks,Mutual Funds etc).

It will list the following detail.
Name of the security, Ticker, Percentage,Market Value, No of shares.

The lay out of the report will be some thing like this

Current Investment Recommended Investment

Stocks 1000$ 20% Stocks 5000 50%
Microsoft 500 10% 10 Oracle 5000 50% 100
Oracle 100 2% 3 -----------------------
GE 250 5% 5 Mutual Fund 5000 50%
IBM 150 3% 2 MF1 2000 20%
----------------------- MF2 2000 20%
MutualFund 4000 80% MF3 2000 10%
MF1 100 2.5 10
MF2 100 2.5 10
MF3 100 2.5 10
MF4 100 2.5 10
MF5 100 2.5 10
MF6 100 2.5 10
------------------------Page Break-------------------------

Current Investment Recommended Investment

MF7 100 2.5 10 Please Refer previous
MF8 100 2.5 10
MF9 100 2.5 10


I hope this will help you to understand the report.

Regards
Krishna Kumar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top