cancel
Showing results for 
Search instead for 
Did you mean: 

Summarize a Shared Variable Field

Former Member
0 Kudos

I have read tons of responses on how to get a shared variable field to summarize, but I can't get anything work. I have only been using Crystal for a short period of time and I'm just stumped. As in bang my head against a wall, stumped LOL

SUBREPORT formula located in GH1

//Shared NumberVar

WhilePrintingRecords;

Shared NumberVar TxnValueVar := Sum ({PV_InvHistory1.TxnValue}, {PV_ShipReqPick1.ShipReqNum})

MAIN REPORT formula located in Details B

//Shared NumberVar

Shared NumberVar TxnValueVar;

TxnValueVar;

I need to create a Total of the TxnValueVar field. I also created a formula which Subtracts the TxvValueVar from the sell price (1st column in photo). I named it profit. I need to summarize the profit field as well.

HELP.

Shelley

Accepted Solutions (0)

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Shelley,

Modify the formula on Details b as:

Shared NumberVar TxnValueVar;

shared numbervar gsum := gsum + TxnValueVar;

TxnValueVar;


Create another formula on the Report Footer with this code to display the Grand Total:


shared numbervar gsum;


-Abhilash

Former Member
0 Kudos

It didn't work... it just pulled the prior record - see screen shot.

Also, I need one for the profit column

MAIN REPORT formula in the DetailsB - {@Profit} is the name of the field

{PV_BillTran1.BillValue}-{@TxnValueVar}

MAIN REPORT formula in RF

WhilePrintingRecords;

Shared numbervar TxnValueVar;

numbervar TotalProfit;

TotalProfit:=TotalProfit+TxnValueVar;

Clearly this isn't correct... but I don't know how to fix it.

THANK YOU so much for your help

Shelley