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

Subreport Design 1

Status
Not open for further replies.

bpngo

Technical User
Jun 18, 2001
11
US
I'm pretty new to Crystal reports and I have a question on whether or not I can (or should) use subreports for what I have to accomplish. I'm currently using Crystal XI. Here's the scenario:
I have two reports, A and B, each of them contain a list of account numbers. I would like to read an account number from report A (which I assume is the main report) and see if that account number is in report B. If it is, I don't want it. If it is not, I would like to print it. Hope this makes sense. Here's an example:

Report A Report B Report Output
(Main) (Subreport)

Z408885 Z420946 Z408885
Z420946 Z428102 Z436163
Z428102 Z472141
Z436163 Z440424
Z440424

Is a subreport the best or only way to do this? Do I have the main report and subreport correct or should they be reversed? Thanks in advance for any help I can get.
 
Using your current set up, I think you could just link the subreport to the main report on the field. Group the main report on the linking field, and place the subreport in GH1a, with your main report field in GH1b. Suppress all sections within the subreport, format the subreport to suppress blank subreport (format subreport->subreport tab->), and in the main report section expert, format GH1a to "suppress blank section". Also remove the border from around the sub.

Then in the sub, add a formula in the report footer:

whileprintingrecords;
shared stringvar ID := maximum({{table.linkingfield});

In the main report, go into the section expert->GH1b->suppress->x_+2 and add:

whileprintingrecords;
shared stringvar ID;
ID <> "" //note no colon

In the Group #1 Footer, add this formula:

whileprintingrecords;
shared stringvar ID := "";

-LB
 
lbass,

Sorry I haven't responded to your solution. Got pulled into another project. Tried your idea and it worked perfectly. Thanks for your help!

bpngo
 
lbass,

I'm getting the correct data to print on the report. The only problem is that I get a blank line where the subreport resides (GH1a). I think I've tried everything to get rid of this, but I can't. Any other suggestions?

Report:

GH1a Blank line...............
GH1b Name: John DOE Acct: t39239
GH1a Blank line...............
GH1b Name: Bill Smith Acct: t99402
GH1a Blank line...............
GH1a Blank line...............
GH1a Blank line...............
GH1a Blank line...............
GH1b Name: Sherry Yates Acct: t94883
etc.
etc.


Thanks,

bpngo
 
You should recheck to make sure you did all of these things:

1) Suppress all sections within the subreport;
2) Format the subreport to suppress blank subreport (format subreport->subreport tab->);
3) In the main report->section expert, format GH1a to "suppress blank section".
4) Also remove the border from around the sub.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top