Code Sample |
(define (ttt mytotalcolumn) (set! myrow R) ;; set our counter to the current row (while (not (null? (@ myrow C))) ;; check that the value exists (next-line) ;; move to the next line (if (not (= (@ myrow C) (@ (+ myrow 1) C)));; are the 2 cells = (prog1 (set! groupsum (sub-total mytotalcolumn)) (insert-line) ;; add extra counting and summing here (next-line) ;; go to the next line (set-data nil (number->string groupsum) 0 LABEL (make-position (+ R myrow) mytotalcolumn )) (set! myrow (+ myrow 1));; increase the row counter ) ) (set! myrow (+ myrow 1)) ;; increase the row counter ) ) (define (sub-total mytotalcolumn) (set! mytotal 0) (set! mycount 0) (set! mytarget (@ myrow C)) (while (and (> (- myrow mycount) 0) (= mytarget (@ (- myrow mycount) C))) (set! mytotal (+ mytotal ( @ (- myrow mycount) mytotalcolumn) ) ) (set! mycount (+ mycount 1)) ) mytotal ) |