[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Siag - a question ...




On Thu, 29 Oct 1998, Pete Phillips wrote:

> Hi Ulric.
> 
> In your last email you said:
> 
> > Currently only by having the sheets in different files, and the references
> > can only be made through the SIOD interpreter. So if you have opened the
> > files file1.siag and file2.siag, you can put this SIOD expression in a
> > cell of file1:
> 
> > (x-get-cell 2 3 "file2.siag")
> 
> > and get the value from row 2, column 3 of file2.
> 
> It doesn't work for me.  I have both spreadsheets open, and one cell
> says (x-get-cell 6 3  "test.siag") - It just gives me an error.

Along the line, the syntax has changed. I'm pretty sure that what I wrote
above was correct for 3.0.x. For 3.1.1, what I'm currently using, this
definitely works:

1. Start Siag
2. Open heaven.siag from the examples
3. Change back to the noname.siag buffer
4. Type this SIOD or Guile expression into a cell:
   (x-get-cell 5 2 "heaven.siag:")

The trailing colon is necessary because the reference is in another buffer
(another file). It is synonymous to

(x-get-cell 5 2 "heaven.siag:Sheet 1")

when Sheet 1 is the first sheet of a buffer.

For references between sheets in a single buffer, there is no need to put
in the buffer name. Had the above expression been in another sheet in
heaven.c, this would have been enough:

(x-get-cell 5 2 "Sheet 1")

or even

(x-get-cell 5 2 "")	; because it is the first sheet of the buffer

> A couple of other things:
> 
> 1 - I wanted to cut and paste some numbers from an xterm into siag. I
> double clicked on the numbers in the xterm, and used the middle button
> to paste them into the spreadsheet.  However, although they appear in
> the spreadsheet, SIAG doesn't appear to know that the cells have
> values in them (e.g., if I sum a column of these figures, I get
> zero). However, if I edit each cell with the Expression/SIOD menu 
> under the right button, and just press <CR>, SIAG now knows that there
> is data there.

Pasted data is always inserted as text. There should be an option to
insert numbers as numbers; it just hasn't been implemented yet.

> 2 - It would be great to have the ability to read a list of commands
> passed on the command line so that a Makefile could dump out a section
> of the spreadsheet as tbl/latex commands (the "teapot" spreadsheet
> already supports this). This means that I could keep our finance
> summaries in multiple spreadsheets, and create a single document by
> using a makefile to dump out each spreadsheet.

I agree. To some degree, Siag can be remote controlled by running it as a
plugin from the command line and feed commands into its stdin. Like this:

[ulric@sparclinux ulric]$ siag -plugin
220 Siag (Scheme In A Grid) 3.1.1. No Warranty.
EXEC (forward-cell)
250 OK
EXEC (quit-siag)

To do this requires some knowledge of the available commands. I'm also
pretty sure that some of the commands were written too much with
interactive use in mind, i.e. they will stop and ask for user input.

> 3 - I keep our finance data in an SQL database (soon to move to either
> MySQL or PostgreSQL) - would it be possible to have an SQL query
> populate the spreadsheet with data from the database ?

All three embedded interpreters (SIOD, Tcl and Guile) have support for
networking, so anything is possible at least in principle. The standard
distribution of SIOD comes with bindings for various databases but I have
stripped those parts out. A determined hacker should be able to put them
back in without too much difficulty.

This is something I would like to have myself. Ideally all the smarts
would be put into separate database drivers. Siag could then use sockets
(or even pipes) to connect to the right driver. That way the spreadsheet
core wouldn't have to be bloated with all kinds of knowledge about
databases.

Ulric