Crystal Reports - Need the sum of a formula that uses 'previous' function

I have a formula named @G Qty.
The formula is:
if (({Glovia_.LOC BIN LOT} = previous ({Glovia_.LOC BIN LOT}) and {@Item Number} = previous ({@Item Number})))
then 0
else {Glovia_.Qty}
I need the sum of this formula at each change in the group 'Item Number'.
I have read examples of how to do this with whilereadingrecords but all it has done is confuse me.
slmcAsked:
Who is Participating?
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:
You do this with 3 formulas

The first formula declares and initializes the variables required
The second formula does the addition/summary
The third formula displays the value

Formula 1 - DeclareVariables
WhilePrintingRecords;
Global NumberVar TotalQty;
TotalQty := 0;
''

Open in new window


Formula 2 - SumQty
WhilePrintingRecords;
Global NumberVar TotalQty;
if (({Glovia_.LOC BIN LOT} = previous ({Glovia_.LOC BIN LOT}) and {@Item Number} = previous ({@Item Number})))  then 
       0
else 
      TotalQty  := TotalQty  + {Glovia_.Qty};
''

Open in new window


Formula 3 - DisplayTotal

WhilePrintingRecords;
Global NumberVar TotalQty;
TotalQty

Open in new window



Formula 1 goes in the report header and the group header
Formula 2 goes in the detail section
Formula 3 goes in the Group footer

mlmcc
0

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
slmcAuthor Commented:
Perfect.  Thank you.
0
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
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.