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 07 2005,18:10 QUOTE

I'm having a really bad morning, and even on my best day I tend to be too blunt. So let me type really slow. (So my brain can keep up with my fingers. No insult intended to the reader.)

First off, Clacker, SaidInUnleashed and Greg, thanks for your answers. From them, I am guessing what I want to do with SIAG is simply not something that it is intended to do.

Secondly, thanks to Clacker for giving the link to the SIAG documents. What I need, I could not find, and that is how to use the scheme language to emulate subtotals..... which is a program, not a function! I.e. the outcome is modifying the underlying buffer by inserting rows and calculating values and putting those values at the correct spots in the buffer. Unless I am being really dense, r_sum and countif only return a single value in the cell in which you place it.

In my more ambitious days, I'd probably have taken the function prototypes found in the documentation and played with them till I figured out how to combine them to get the results I wanted. I am not that ambitious anymore. I was hoping to find something simliar to what I wanted, that I could then modify.

Anyway, thanks for trying.
David
Back to top
Profile PM 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: July 07 2005,18:20 QUOTE

dbickin, I'm sorry, but I edited my previous post while you were posting the above.

You're correct that you need to write the function in scheme, if I understood what you were asking.  You can try it, but I had problems with the current line not incrementing.
Back to top
Profile PM 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: July 07 2005,21:35 QUOTE

dbickin, I found a ton of undocumented function in the /KNOPPIX/usr/local/share/siag/ directory and especially in /KNOPPIX/usr/local/share/siag/siag/siag.scm.  There are usefull things like llpr to write to the status bar and number->string to do conversions.

The power is in there, but the extreme lack of documentation means you have to hunt around a bit.

Here is some scheme code I wrote for siag to take a sorted column of numbers and add a blank line between the groups.  You might be able to use it as a start for what you want to do:

Code Sample

(define (ttt)
  (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
           (insert-line)            ;; add extra counting and summing here
           (next-line)              ;; go to the next line
           (set! myrow (+ myrow 1));; increase the row counter
        )
     )
     (set! myrow (+ myrow 1))      ;; increase the row counter
  )
)
Back to top
Profile PM 
dbickin Offline





Group: Members
Posts: 23
Joined: Mar. 2005
Posted: July 07 2005,23:25 QUOTE

clacker, thank you!!!! That is exactly the kind of code sample I was looking for. The only thing missing is actually inserting the r_sum or count function where it needs to go.

Again,
Thanks.

David
Back to top
Profile PM 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: July 08 2005,12:48 QUOTE

dbickin, try this version.  I added another function to do the counting.  It creates a new row and places the sum in the next column.  You should be able to see what's going on with siag from this example so that you can modify it to be what you realy wanted.  set-data is the function that puts values into cells.  You can look at some of the scm files on the dsl CD to see more examples of its use.  I'm hacking and slashing here, I'm sure you can do this better.

Code Sample
(define (ttt)
 (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-count))
          (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)(+ C 1)))
          (set! myrow (+ myrow 1));; increase the row counter
       )
    )
    (set! myrow (+ myrow 1))      ;; increase the row counter
 )
)

(define (sub-count)
  (set! mycount 0)
  (set! mytarget (@ myrow C))
  (while (and (> (- myrow mycount) 0) (= mytarget (@ (- myrow mycount) C)))
     (set! mycount (+ mycount 1))
  )
  mycount
)
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