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!

Pulling Values from Subreport at Print time

Status
Not open for further replies.

trialbyfire

IS-IT--Management
May 11, 2002
19
US
I am trying to pull in negative and positive values from 3 seperate subreports that normally only print the sum of all of the discounts and charges. An example being order charges subreport. May have several lines of discounts and one charge for shipping. I am trying to seperate the values in the subreports and pull two seperate total values into the main report. This appears to be working for the charges but not for the negative values. It is also copying the charge to all of the invoices following the one with the charge. See seperate post "Subreports containing negative and positive values" Rogar was of great help on this subject but I have hit brick wall on the two issues listed above. Here are the formulas I am using. "Note" These are running totals

Subreport Header:
WhilePrintingRecords;
CurrencyVar allowance := 0;
CurrencyVar charge :=0

Subreport Detail:
//These are in two seperate running totals. One for negative value and one for positive value. Formulas are the same for all three subreports with the exception of different running total names and the database file that holds the information.

WhilePrintingRecords;
CurrencyVar charge;
{ar-inv-prt-itm.charge-amount} < 0

WhilePrintingRecords;
CurrencyVar charge;
{ar-inv-prt-itm.charge-amount} > 0

Subreport Footer:
//These are in two seperate running totals. One for negative value and one for positive value. Formulas are the same for all three subreports with the exception of different running total names.

shared NumberVar nNegTotal;
nNegTotal := nNegTotal + {#RTotal0};
WhilePrintingRecords;
CurrencyVar allowance;

shared NumberVar nPosTotal;
nNegTotal := nPosTotal + {#RTotal1}
WhilePrintingRecords;
CurrencyVar charge;

Main Report:
//This is in the fields where I want to populte the sums from the subreports. They are also in two seperate fields.
shared NumberVar nPosTotal;
shared NumberVar nNegTotal;


Any ideas anyone?
 
Ok...let us start from the beginning...I read the other post and it left me confused...you have 3 subreports + a main report

****************************
Describe each subreport...what are each subreport grouped on and what value(s) are you sending back to the main report.
****************************

WhilePrintingRecords;
CurrencyVar charge;
{ar-inv-prt-itm.charge-amount} < 0

this seems to me to be a snippet of a formula not a complete formula...I see no reference to the vairiable &quot;Charge&quot; elsewhere other than defining it.

the result of this formula will be a boolean yes/no there is no assignment of value here.

When you say that you wish to separate positive and negative values...is this within each subreport??? This is not difficult but the way it is described is confusing.

I repeat .... describe each subreport in detail...its purpose and structure, what is being sent to the main report and how all the results are combined....

A simple numeric example would be nice.

Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top