Doorgaan naar hoofdcontent


Posts uit mei, 2015 weergeven

Crystal Reports: Running Total Conditionally Showing Up

Got a question from a person. She wanted a running total only to show up when a certain limit or a multiple of that limit was crossed. In my example, this limit is 5000, Running Total is showing every time 5000 or a multiple of 5000 is crossed:

The example is based on the table Order_Details from the NorthWind database. First, I created a formula field Revenue:


In only managed to create the Running Total by by creating a Formula Field Running Total:

currencyvar curTotal;
currencyvar curSubtotal;
numberVar numCounter;
curTotal:=curTotal + {@Revenue};
//numCounter:= curTotal\{?RunningTotalLimit};
if {@Revenue} < {?RunningTotalLimit} then
    if curTotal \ {?RunningTotalLimit} = numCounter + 1  and curSubtotal = 0 then
        curSubtotal:= curTotal;
        numCounter:=numCounter + 1
        if curTotal \ {?RunningTotalLimit} >= numCounter + 1 and curSubtotal = 0 then