Crystal Reports 9 - Totaling a NumberBar psssed from a Subreport

I am trying to get a running total of a variable passed from a sub report.  The variable is declared in both the main report and the sub report.  If a condition in the sub report is true then the variable “Won” gets a value of 1.  If it is false it gets a value of 0.

WhilePrintingRecords;
Shared NumberVar Win;
Win := {@Success}

The sub report has been placed on the main report and the variable has been declared.

WhilePrintingRecords;
Shared NumberVar Win;

I also have reset the variable

WhilePrintingRecords;
Shared NumberVar Win := 0

 I can see the values 1 or 0 in the main report at the correct places.
I need to be able to sum the variable values to get a count.  I cannot use the summary functions or her running total functions as they won’t work.
How can I do this?
crawforditAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
Try totalling the variable when you display it.

Report header
WhilePrintingRecords;
Shared NumberVar Win;
Global NumberVar TotalWins;
""

Display Win
WhilePrintingRecords;
Shared NumberVar Win;
Global NumberVar TotalWins;
TotalWins := TotalWins + Win;
Win


Display total
WhilePrintingRecords;
Shared NumberVar Win;
Global NumberVar TotalWins;
TotalWins

mlmcc
crawforditAuthor Commented:
Guess I am a bit thick cecaus i could not get it to work.  thanks any way
mlmccCommented:
Did you create 3 formulas?

The first one goes in the main report header
The second replaces the formula you are using to display the value in the main report
The third goes where you want to display the total

mlmcc
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

crawforditAuthor Commented:
Ok got it

Actually created 4 fromulas
Placed GF4
WhilePrintingRecords;
Shared NumberVar Win;
I think tis brings var from Sub report

Pkaced in GH4
WhilePrintingRecords;
Shared NumberVar Win := 0
Resets Var to 0

Also in GH4
WhilePrintingRecords;
Shared NumberVar WinTot;
WinTot := Wintot + {@Won};
sub totals as we cycle thorugh the records

Place in RFWhilePrintingRecords;
Shared NumberVar WinTot;
WinTot
prints grant total in the footer

thanks for your help it got me moving in the right direction
mlmccCommented:
I wasn't clear if you need to reset the total or not.  I should have suggested it.

mlmcc

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
crawforditAuthor Commented:
Thanks for you help
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DB Reporting Tools

From novice to tech pro — start learning today.