CTN(SOURCE, DESTINATION [, NORESET]) - counts data field or report variable for values <> 0

Source - data field or report variable to count.
Destination - report variable to store result of the function.
Noreset - use this option if you don't want to initialize destination variable with zero value. New not zero values of the source field will be counted beginning from the previous result of the function.

Example of a report:

\scan(a)\
\a:number\ - \a:value\
\endscan, ctn(a:value,c_value)\
Count of non zero values: \c_value\

\scan(b)\
\b:number\ - \b:value\
\endscan, ctn(b:value,c_value,noreset)\
Count of non zero values in both tables: \c_value\

Result may be like this:

1 - 5
2 - 0
3 - 4
Count of non zero values: 2

1 - 10
Count of non zero values in both tables: 3

Next topic: Cts function