troubleshooting Question

using a summary field in a formula calculation

Avatar of trs28
trs28 asked on
Crystal Reports
7 Comments1 Solution1576 ViewsLast Modified:
I have a report listing customers and their payments (and other various info of course)...

Here is a simple example with their field names to show where the data is located->    
        achreport.studentname  |   achreport.payment
        George Worley              |     100.00
        Neil Heverly                  |       25.00
        Galen Reigh                  |     100.00
        Paul Stolz                     |      (80.00)
                                    TOTAL:   145.00                   <-------- 'Sum of achreport.payment'

My problem is that I need the "TOTAL" field to NOT reflect any negative values in its summary but still list it with the positive payments.  I know you might be thinking, "Now how could that ever be correct?"   Don't worry, for the information the report will give to the client, this is the exact logic I need.  

I created a formula (called negativeTracker) to track any negative values and keep a running total:

          shared currencyvar negAmnts := 0.00;
          shared numbervar negCnt := 0;
          if {AchReport.Payment} < 0.00 then
                 negAmnts := negAmnts + abs({AchReport.Payment});
                 negCnt := negCnt + 1

The part I'm having trouble with is using the result of this formula to adjust the "TOTAL" information accordingly!   In other words, I can't seem to figure out how to accomplish this functionality in a formula ->  Sum of AchReport.Payment + negAmnts

The 'negAmnts' part I've got, but I just can't seem to figure out how to reference "Sum of AchReport.Payment"


- Travis -

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros