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!

Shared Variables- usage in main report

Status
Not open for further replies.

c15bm

Programmer
May 29, 2003
10
CA
this is related to my earlier post. Thanks for the help.

In the subreport, I originally totalled the amount field by location_code, unit_name & facility_id. I suppressed all but the location_code summary amount.

The main report has consumption quantity & amount field summarized by location_code, unit_name & facility_id.
(Records in two key tables cannot be linked -thus the subreport)

I thought I could pass the location_code amount back and use it to add to the totals in the main report. I've put the subreport in the Group 3 Header (Location Code break) and I have put the shared variable in the Group 3 footer.

This works fine now, I'm even able to use the amount in a new formula to include it in the location_code total formula. I had to clear the amount each call because it
printed the last amount when there were no adjustments from the subreport.

However the problem is when I try to use that amount in the unit_name totals or the facility_id totals. Not sure how to do that. The new formula does not show up when I want to create a summary in the unit_name and facility_id footers.

new formulas:
Sum ({@F_TOTAL_AMOUNT}, {VW_CONSUMPTION_QTY_CONV.INVENTORY_LOCATION_CODE}) + {@F_TOT_LOCATION_AMT}

tried:

Sum ({@F_TOTAL_AMOUNT}, {VW_CONSUMPTION_QTY_CONV.UNIT_NAME}) + {@F_TOT_LOCATION_AMT}

but that just included the last location_code total, not a sunnary of the location_code totals for that Unit.
 
To total a variable, you actually need to create another variable and total it yourself. So everytime you get a new value, you add it to the total variable as well.

Lisa
 
Not sure I understand. Even if I create another formula using the total from the location_code field, the new formula doesn't appear in the listing of fields to summarize. Could you give me an example of how to create the formula and use it ?? Thanks
 
You sumarize it yourself. Every time you want to add more to the total.

totalholder := totalholder + newamount

Lisa

So say you wanted to total a sum from your subreport. I usually do this in my display formulas..

add

global numbervar totalholder;

then add before the display of say locationAmount..

totalholder := totalholder + locationAmount.

So "totalholder" is a hand created running total.. which will be the complete total by the time you get to the end.

Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top