Custom Reports

Doug Latornell doug-gnucash at sadahome.ca
Thu Jan 25 14:42:55 EST 2007


On 1/25/07, Derek Atkins <warlord at mit.edu> wrote:

<snip>
>
>
> >> b) on a related note, whether there were any plans to implement some
> kind
> >> of
> >> API for the custom reports for the informal user, so that they could
> >> delete
> >> reports or modify them.
> >
> > Not really, at present.  I've heard that there's an ability to load
> custom
> > reports from a user directory, but I don't see documentation of
> it.  That
> > at least would let the user add new (or modifications of existing)
> reports
> > without mucking with the installed tree.  I'd imagine future systems for
> > handling reports would do a similar process of enumerating a set of
> known
> > directories/locations for reports to register at runtime.
>
> I think just doing something like this in ~/.gnucash/config.user
> will do the trick in 2.0:
>
> (load-file "/path/to/my/personal/report.scm")
>
> Note that this hasn't been tested.


I tried to test this...

Maybe I'm doing something wrong, but this didn't work for me (GC 2.0.2 on
OSX 10.4.8 PPC via MacPorts).  I copied advanced-portfolio.scm to
~/Documents/gnucash/report/foobar2.scm, changed the module name and report
name in foobar2.scm, created ~/.gnucash/config.user, and put a line as above
in it.  Started GC, and there was no foobar2 in the report list.

Tried registering foobar2 in standard-reports.scm.  Started GC and got the
following on the terminal:
Ludwig:doug$ gnucash &
[6] 23235
Ludwig:doug$ Backtrace:
In unknown file:
   ?: 18* [#<procedure #f ()>]
   ?: 19* (let ((file #)) (cond (# => #) (# => #)))
   ?: 20  [#<procedure #f #>
"/opt/local/share/gnucash/guile-modules/gnucash/report/$
   ?: 21  [load-file #<primitive-procedure primitive-load> ...]
   ?: 22* [save-module-excursion #<procedure #f ()>]
   ?: 23  (let (# #) (dynamic-wind # thunk #))
   ?: 24  [dynamic-wind #<procedure #f ()> #<procedure #f ()> #<procedure #f
()>]
   ?: 25* [#<procedure #f ()>]
   ?: 26* [primitive-load
"/opt/local/share/gnucash/guile-modules/gnucash/report/sta$
In /opt/local/share/gnucash/guile-modules/gnucash/report/standard-
reports.scm:
  73: 27* (use-modules (gnucash report foobar2))
  73: 28  (eval-case (# #) (else #))
In unknown file:
    ...
   ?: 29  [for-each #<procedure #f (mif-args)> (((gnucash report foobar2)))]
   ?: 30* [#<procedure #f (mif-args)> ((gnucash report foobar2))]
   ?: 31* (let ((mod-iface #)) (or mod-iface (error "no such module"
mif-args)) ...)
   ?: 32* [apply #<procedure resolve-interface (name . args)> (#)]
   ?: 33  [resolve-interface (gnucash report foobar2)]
    ...
   ?: 34  (let* (# # # #) (and # #) (if # public-i #))
   ?: 35* (and (or (not module) (not public-i)) (error "no code for module"
name))
   ?: 36  [error "no code for module" (gnucash report foobar2)]
    ...
   ?: 37  [scm-error misc-error #f ...]

<unnamed port>: In procedure scm-error in expression (scm-error (quote
misc-error) #f ...):
<unnamed port>: no code for module (gnucash report foobar2)

Note that creating foobar.scm in
/opt/local/share/gnucash/guile-modules/gnucash/report/ and registering it in
standard-reports.scm works fine for me, but as Josh noted, that's mucking
about in the install-tree, and I get what I deserve if I mess thing up...
:-)

Doug


More information about the gnucash-user mailing list