Report development without the need to restart GnuCash

Donald Allen donaldcallen at gmail.com
Thu May 22 15:44:25 EDT 2008


On Thu, May 22, 2008 at 2:09 PM, Torsten Edeler <torsten at edeler.org> wrote:
> Hi everybody.
>
> I'm quite new to GnuCash. Recently I felt the need to make my own report
> adapted to my needs, since the existing reports were not suitable. After
> taking a look to this obscure language Scheme - which I will probably never
> like :-)

Perhaps. But I refer you to the book "Structure and Interpretation of
Computer Programs", by Abelson, Sussman and Sussman (MIT Press). If
you make the investment of your time to read this classic book, you
will be amply rewarded. And you will come to understand, I'm quite
sure, why Scheme makes so much semantic and syntactic sense. And when
you've written programs in an environment that supports it properly,
such as MIT Scheme, you are very likely to find that you are more
productive in Scheme than any other language.

Scheme, and it's parent language, Lisp, has always been a hard sell,
because people look at Scheme programs and they don't look like what
they expect computer programs to look like. And they tend to dismiss
it at that point, without considering that the language was designed
by some extremely smart people, and there are good reasons why it is
the way it is.

/Don


- the question rised how to develop reports without having the need
> to restart the whole application after a little bit of the report had to be
> changed. I searched the mailing list, but hadn't found anything usefull.
>
> I would like to present my solution to that problem to you. Perhaps it has
> already been solved (probably more elegant) by some of you or I missed it in
> the ml. Anyway this is what I use at the moment for development.
>
> I have the report file which is load by GnuCash on Startup:
>
> (define pagename-general "General")
> (define (options-generator)
>    (load "/home/torsten/.gnucash/reports/myoptions.scm")
>    (myoptions)
> )
>
>
> (define (renderer options)
>    (load "/home/torsten/.gnucash/reports/renderer.scm")
>    (myrenderer options)
> )
>
>
> (let ()
>  (gnc:define-report
>   'version 1
>   'name (N_ "Trivial Example")
>   'options-generator options-generator
>   'renderer renderer)
> )
>
> As you can see the renderer and the options-generator include a file load.
> So everytime GnuCash executes one of the functions, a fresh version of the
> file is loaded and executet. The files itself defines a function "myoption"
> and "myrenderer" respectively. Note that the option-generator is only
> executed after loading the report from the menu (or on startup), whereas the
> renderer is also executet after reloading or modification of the options.
>
> Unfortunatly GnuCash is very sensible to errors in the option-generator,
> since it simple terminates the whole application. The renderer behaves more
> nicely: Only an error message is displayed in the report window and one has
> the chance to modify the file and reload the report.
>
>
> I hope this little texts helps some of you. At least it would have helped me
> :-)
>
> regards,
> Torsten
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
>


More information about the gnucash-user mailing list