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

Grand Totals for Subreport

Status
Not open for further replies.

bpvsc

MIS
Apr 30, 2002
18
US
Greetings,
I have researched as much as possible for a solution to my dilema and do not see anything relative so I am posting for the pros....

I am trying to calculate grand totals from a sub report.
I have a report with a subreport retreiving data from a different data source:
Main Report = AS400
Linked Sub report = Different data source. A reference table for Options
The link is PKOPT. My report calcs are correct at the group level -PKOPT-
(?Pm-Sum of @Dozens}*{IXOPTN00.OPSLTM}
on the subreport but I want a grand total of all op codes that are relative from the subreport to the main report which is determined by date parameter. I have tried an additional sub report with the same link and using a grand total. My total still reflects the join of the 2 reports fields PKOPT = PKOPT at the group level

Any suggestions?

 
Create a formula using a shared variable to return to the main report.

In the subreport, create the following formula:

shared numbervar SubNum:=SubNum+((?Pm-Sum of @Dozens}*{IXOPTN00.OPSLTM})

Now in the main report AFTER the subreport has run, you can use that variable, as in:

shared numbervar SubNum;
"The subreport returned: "+ totext(Subnum,0,"")

You can use it in calcs or whatever.

Hope this helped you to understand the basics, the help files cover this pretty well, as do many posts here.

-k
 
Could you add a new subreport to the group footer, and link it to the date range in your main report. That way it would total for all Options, for the selected date range.

Peter Shirley
 
Yep. Providing by Date Range you mean to say a Date Range Parameter.

You could place it anywhere if you're just going to leverage the Parameter.

When you set up the link, select the parameter from the main report, and then the field from the subreport.

-k
 
Thanks to all -

I used:
shared numbervar SubNum:=SubNum+((?Pm-Sum of @Dozens}*{IXOPTN00.OPSLTM})

Now in the main report AFTER the subreport has run, you can use that variable, as in:

shared numbervar SubNum;
=======
I was using a shared var but trying to create another subreport for the inital calc. Putting it in the 1st one was the trick.
Again Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top