URGENT QUESTION on ACCUMULATE

nate100

Member
Hello, I have the following query but not sure how to get accum based on if yytmp_value1 = "cc" is true.. Thanks in advance for your help.

for each yytmp no-lock break by yytmp_addr:
ACCUMULATE yytmp_coop (total by yytmp_addr).
if last-of yytmp_addr then
display
yytmp_addr
(accum total by yytmp_addr yytmp_coop)
/* I also need to show here (accum total by yytmp_addr yytmp_coop) if yytmp_value1 = "cc" as well but not sure how to*/
end.
 
Why not just count it yourself. (and don;t use accumulate)
Define the necessary variables and display the results when needed.

Casper.
 
Your requirement is not clear to me. As written, it seems like you are displaying the same values twice when a particular condition is met. My guess is that you actually want a second total which only includes records meeting that condition. If that is the case, then Casper is correct that the easiest route is simply to define a couple of variables for the totals and do you own totaling with if tests. Accumulate is a very handy shorthand, but it really only handles the things that it handles and when you want to do something else, it is back to doing it by hand.
 
Back
Top