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

Adding a total to a column that contains a formula passed from subreport 1

Status
Not open for further replies.

GCL2007

IS-IT--Management
Dec 11, 2007
167
US
Using Crystal XI, I having a hard time figuring out how to get the total of a column in a report. My issue is I have a formula @numbersprue which contains a formula @pc/sprue that is passed from a subreport. The report works fine, but I need to put a total sum at the bottom of the @numbersprue column. Having difficulty... Any thoughts???


@numberSprue formula:

if instr({Standop.OPNO}, "-10-")>0 then
{LABOR.PROCESS_QTY}
else
if {@pc/sprue}=0 then 0
else
if {@pc/sprue}<>0 then {LABOR.PROCESS_QTY}/{@pc/sprue}


Where @pc/sprue is a formula passed from a subreport

If shared stringvar sprue = " " then 0 else
tonumber(shared stringvar sprue)
 
Because subreports are run after any summary functions are calculated, you'll need to use variables to accumulate the values from subreports.

For example, you might modify your existing formula as follows:
Code:
WhilePrintingRecords;
NumberVar accum ;
NumberVar numbersprue
numbersprue := (
if instr({Standop.OPNO}, "-10-")>0 then 
{LABOR.PROCESS_QTY} 
else 
if {@pc/sprue}=0 then 0 
else 
if {@pc/sprue}<>0 then {LABOR.PROCESS_QTY}/{@pc/sprue}
)
accum := accum + numbersprue ;
numbersprue
Then, in your report footer, use a formula to display the accumulated value:
Code:
WhilePrintingRecords ;
NumberVar accum



Bob Suruncle
 
Thank you.. That worked out great for me....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top