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

Subreport links

Status
Not open for further replies.

mcquam

Technical User
Feb 26, 2007
89
GB
I have a main report with a linked subreport but I can only see zero values on the main report. I suspect it is a problem with my links as the subreport returns zero records after I linked it.

The subreport (fees1) groups outlays (fees paid) by matter code. eg:
Code:
RHb MT-CODE            NET-VALUE
GH1 BBBB0003/000006    -30
GH1 BBBB0003/000007    -30
GH1 BBBB0003/000016    -30
GH1 BBBB0003/000019    -30

There is a formula (outlays) to share the group1 outlays figure with the main report:
Code:
WhilePrintingRecords;
Shared numberVar  outlays:= Sum ({NOMTRANS.NET-VALUE}, {NOMTRANS.MT-CODE});

The main report has a formula to show the outlays variable:
Code:
WhilePrintingRecords;
Shared numberVar outlays;
numbervar showoutlays := outlays;

This formula is placed in the detail section with the subreport supressed in RHi.

I am trying to link on mattercode but it seems to default to a parameter which I don't want as using the paramenter changes the subreport to return zero records.


I am using MSAccess and CR11.
 
Yes, I mean the outlays figure which is the formula @sumoutlays with the code:

Code:
whileprintingrecords;
shared numbervar aveoutlays

and the @aveoutlays code from the subreport:
Code:
WhilePrintingRecords;
Shared numberVar  outlays:= -Sum ({NOMTRANS.NET-VALUE}, {NOMTRANS.MT-CODE});
shared numbervar aveoutlays:= average({NOMTRANS.NET-VALUE},{NOMTRANS.MT-CODE});

The reason I am confident it is the last record is that there are only values of £30.00 going through so possible output will be a multiple of £30.00 or zero. An average will not be any of these.

I have reset at GH2a:
Code:
whileprintingrecords;
numbervar cnt := 0;
numbervar cntx := 0;
numbervar sumdiff := 0;
shared numbervar aveoutlays:=0;

The dates are not matched between main and sub. I have selected a wider date range in the sub to ensure I am getting all the records for the main but I'm only linking on matter code. The date fields are unrelated: the main report date is when the case completed and the sub is when a fee transaction occurred of which there could be several.
 
I can't troubleshoot this without seeing some sample data that also designates the sections the data is in, and where your formulas are located.

-LB
 
Before I do, can I just check with you that what I'm trying to do is valid in Crystal, ie, that I am trying to show summarised group data from a subreport in the detail level of a main report linked only by my primary key field? I then need to summarise it again in a specified order group in the main report.
 
OK I'm pretty close. I moved the subreport to Details a which I think you alluded to in your first post. I am now getting correct results for the @outlays field into the main report. My only problem is getting an average of this field. Do I need to do a manual sum, reset etc?
 
Yes, please review previous posts, and you will see that you already have the tools to move forward.

-LB
 
Many thanks for your help and patience lbass, I'm sure I'll figure out the rest now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top