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

Sub report does not return data if container report returns zero recor

Status
Not open for further replies.

BFAGG

MIS
Aug 23, 2001
64
GB

Crystal 9.

I have a report with a linked sub report.

The reports are linked by a parameter value.

If the container report returns zero records, the sub report is also blank even if there are records in the database which conform to the passed parameter.

Any body give me a clue??
:-(

 
If the parameter value is being passed to the sub report correctly then the sub report data should display.

Make sure the sub report is linked to the main report parameter field and not a data field. Otherwise give more information on the report structure and linking.

Gary Parker
MIS Data Analyst
Manchester, England
 
You might try making the subreport the main report and the main report, the subreport.

-LB
 
lbass - Thanks but I can't make the sub report the main report as it wouldn't make sense. In our database the problem could exist even if I did this.

Gary Parker - The sub report is linked by passing a parameter and does not rely on any field in the container report. The container report uses the parameter
?Salesperson to query sales opportunity records. This parameter is then passed to the sub report which uses it to query activity records. The records are held in different tables but on the same database. I have tried linking both by using the parameter and by puttin the parameter into a formula and using this as the link. Neither work.

Regards
Bill Fagg
Manchester
 
Bill

This parameter is then passed to the sub report

is this done using sub report links ?

This should be set up as

Field(s) to link to -> ?mainParam
SubReport parameter field to use -> ?Pm-?SubParam (Select this from the drop down list created automatically)

I have tested this using V9 and this works fine.

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
Gary,

Yes,
I have linked using ?PM-?salesperson and selected data in sub report based on field vOpportunity.SALESPERSON_NAME

The sub report selection criteria then contains the phrase
{vOpportunity2.SALESPERSON_NAME} = {?Pm-?salesperson}

Can't see what is causing the problem. Everything works OKif the container report returns records. If the container report returns no records then the sub report is also blank even though there should be records.

Cheers
Bill
 
I replicated the problem and the following worked.

Remove the subreport link. In the main report, create a formula {@sharedparm}:

whileprintingrecords;
shared stringvar salesperson := {?salesperson};

Place {@sharedparm} in the report header and suppress it.

In the subreport, go to the section expert (format->section)->details->suppress->x+2 and enter:

whileprintingrecords;
shared stringvar salesperson;

{activity.salesperson} <> salesperson

You didn't specify where your subreport was or whether you were using any other links. If this doesn't work for you, then please provide more information about your report structure.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top