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

Summarising A Field From a Subreport

Status
Not open for further replies.

CIBS

Technical User
Nov 15, 2007
73
0
0
GB
Hi

I am using CR9

I have a main report that is using group based on the call code.
I have a subreport that calculates the Labour & Parts for each Call (In the subreport there is another group based on the call number). The reason for this is that the Oracle database duplicates events such as the status on an invoice/charge, so the subreport deals with these issue's whilst the main report deals with other issues. This subreport is passing across the corrcet information for each call logged but what I want to do is have a grand total of the Labour field and a grand total of the part field at the bottom of the report

Additional information that may help

The reports are linked together by the call_no

Parameters used (Main Report)

Priority Code
Wildcard Search On Products
Date Range

I believe it is an issue with the linking as I have created a 2nd subreport with the same layout as the 1st report but have created grand summaries. Now if you drop this in the call group it brings that information back no problems but put the subreport in the footer and it just brings back the last call group information.

I have thought of using shared numbervar to bring the information to the main report so that the summary can then be created in the main report,but it's not working for me

I have for example have

subreport

shared numbervar CalloutC :=0;
CalloutC := sum({@Cost_Callout},{CALL.CALL_NUMBER})

main report

shared numbervar CalloutC :=0

but on the main report just displays the first value repeated throughout the entire report.

Any Ideas much appriciated

Kind Regards

Stephen

 
If you add the second subreport to the report footer, do not link on the call group field. You should only link parameter fields to each other (if used in the subreport) by using the dropdown in the lower left of the subreport linking screen to select {?parm} instead of the default {?pm-?parm}. Then in the sub, you should have a record selection formula that references the parms you created within the sub, just as you do on the main report.

Alternatively, you can use shared variables and then sum them in the main report, but if you are okay with having a grand total sub, that is probably simpler.

-LB
 
Hi

I have now managed to use the shared numbervar feature to pull the value to the main report and display the correct value depending on the group

Example

Group = Call No

Call No. Cost
67863 44.00
67864 55.00
67965 47.50


What I want to do now is a grand total but the field will not allow me to summarise it. So what I should get is 146.50

Any further ideas

Kind Regards

Stephen
 
Change the same formula where you are referencing the shared variable in the callnumber group to:

whileprintingrecords;
shared numbervar CalloutCl;
numbervar sumcallout := sumcallout + CalloutC1;
CalloutC1

Then in the report footer, use a formula like this to display the results:
whileprintingrecords;
numbervar sumcallout;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top