Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ 1 2 [3] >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: spreadsheet subtotals, siag doesn't seem to have subtotal tool< Next Oldest | Next Newest >
dbickin Offline





Group: Members
Posts: 23
Joined: Mar. 2005
Posted: July 08 2005,18:01 QUOTE

I modified it to add the values in a second column passed as an argument

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
)


(Hopefully I transcribed the changes correctly. my DSL laptop is not networked!)

I'm going to have to see if I can figure out how to get it to work when the key column has text instead of numbers in it. And see if I can figure out how to make the totals show in bold. (I hate that Excel doesn't do that! OpenOffice got it right.)

Clacker, in your searches through the files, have to run into anything like an Outline in OpenOffice Calc. That is... [+] or [-] button to the left of the spreadsheet tht either shows or hides the detail of each subtotal function?

H'm, I suppose I should look to see if siag CAN hide or show rows before I ask a question like that..... Oh well. Much to learn.

Thanks for all your help.

David
Back to top
Profile PM 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: July 08 2005,21:16 QUOTE

Showing things in bold using the scheme interface is accomplished with a (toggle-format "bold") command.  I searched the /KNOPPIX/usr/local/share/siag/siag/siag.scm file for that.

No clue how to hide rows like excel can.  I tried setting the row height to 1 pixel, but that didn't work.
Back to top
Profile PM 
11 replies since July 01 2005,15:37 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ 1 2 [3] >/
reply to topic new topic new poll
Quick Reply: spreadsheet subtotals

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code