How to make simple working guile report
Valdis Vītoliņš
valdis.vitolins at odo.lv
Tue May 18 09:32:45 EDT 2010
Huh..
Reading many samples and web pages
(mainly http://www.widyono.net/prog/gnucash-xacc-repdev.html
http://wiki.gnucash.org/wiki/Custom_Reports and
http://wiki.gnucash.org/wiki/Custom_Reports_Using_Eguile )
I have distilled more or less simple report without dependencies on
other libraries.
== Environment ==
Ubuntu 10.04
Guile 1.8.7
GnuCash 2.3.12 r19180M
== Files ==
valdis at studio:~$ cat ~/.gnucash/config.user
(load-from-path "/home/valdis/Darbvirsma/Gnucash/report.scm")
valdis at studio:~$ cat ~/.gnucash/log.conf
# http://wiki.gnucash.org/wiki/Logging
[levels]
gnc=message
gnc.scm=debug
[output]
to=stderr
valdis at studio:~$ cat ~/Darbvirsma/Gnucash/report.scm
(gnc:debug "Loading /home/valdis/Darbvirsma/Gnucash/report.scm")
(define (renderer options)
(let ((document (gnc:make-html-document)))
document)) ;;; Generates an empty document
;; Here we define the actual report with gnc:define-report
(gnc:define-report
;; The version of this report.
'version 1
;; The name of this report. This will be used, among other things,
;; for making its menu item in the main menu. You need to use the
;; untranslated value here!
'name (N_ "My Test report")
;; The GUID for this report. This string should be unique, set once
;; and left alone forever after that. In theory, you could use any
;; unique string, even a meaningful one (!) but its probably best to
;; use a true uuid. Get them from `uuidgen | sed -e s/-//g` and paste
;; the results in here. You must make a new guid for each report!
'report-guid "898d78ec92854411bf76e20a36d24ad1"
;; The name in the menu
;; (only necessary if it differs from the name)
'menu-name (N_ "My Test report")
;; A tip that is used to provide additional information about the
;; report to the user.
'menu-tip (N_ "My Test report")
;; A path describing where to put the report in the menu system.
;; In this case, it's going under the utility menu.
'menu-path (list gnc:menuname-utility)
)
(gnc:debug "loading finished")
Though when I run this report I get following error in console:
In /opt/gnucash-svn/share/gnucash/guile-modules/gnucash/report/report-gnome.scm:
78: 1* (let* ((report #)) (gnc-main-window-open-report report
window))
80: 2 [gnc-main-window-open-report 0 #<swig-pointer GncMainWindow *
16e7000>]
In current input:
1: 3* [gnc:report-run 0]
In /opt/gnucash-svn/share/gnucash/scm/report.scm:
668: 4 (let ((report #) (html #f)) (gnc-set-busy-cursor (quote ())
#t) ...)
671: 5* [gnc:backtrace-if-exception #<procedure #f ()>]
In unknown file:
?: 6 (letrec ((dumper #)) (catch (quote ignore) (lambda () #)
(lambda # #f)))
In /opt/gnucash-svn/share/gnucash/guile-modules/gnucash/main.scm:
139: 7 [catch ignore #<procedure #f ()> #<procedure #f (key . args)>]
In unknown file:
?: 8* [#<procedure #f ()>]
In /opt/gnucash-svn/share/gnucash/guile-modules/gnucash/main.scm:
142: 9* [lazy-catch #t #<procedure #f ()> #<procedure dumper (key .
args)>]
In unknown file:
?: 10* [#<procedure #f ()>]
In /opt/gnucash-svn/share/gnucash/guile-modules/gnucash/main.scm:
143: 11* [apply #<procedure #f ()> ()]
In unknown file:
?: 12 [#<procedure #f ()>]
In /opt/gnucash-svn/share/gnucash/scm/report.scm:
...
675: 13 (set! html (gnc:report-render-html report #t))
675: 14* [gnc:report-render-html # #t]
638: 15 (if (and (not #) (gnc:report-ctext report)) (gnc:report-ctext
report) ...)
646: 16 (let ((template #) (doc #f)) (set! doc (if template # #f))
doc)
649: 17* (set! doc (if template (let* (# # # ...) (if #
# ...) ...) ...))
649: 18* (if template (let* (# # # ...) (if # # ...) ...) ...)
650: 19 (let* (# # # #) (if # # #) (gnc:report-set-ctext! report
html) ...)
652: 20* [#f #]
/opt/gnucash-svn/share/gnucash/scm/report.scm:652:35: In expression
(renderer report):
/opt/gnucash-svn/share/gnucash/scm/report.scm:652:35: Wrong type to
apply: #f
* 16:29:20 WARN <gnc.scm>
In /opt/gnucash-svn/share/gnucash/guile-modules/gnucash/report/report-gnome.scm:
78: 1* (let* ((report #)) (gnc-main-window-open-report report
window))
80: 2 [gnc-main-window-open-report 0 #<swig-pointer GncMainWindow *
16e7000>]
In current input:
1: 3* [gnc:report-run 0]
In /opt/gnucash-svn/share/gnucash/scm/report.scm:
668: 4 (let ((report #) (html #f)) (gnc-set-busy-cursor (quote ())
#t) ...)
671: 5* [gnc:backtrace-if-exception #<procedure #f ()>]
In unknown file:
?: 6 (letrec ((dumper #)) (catch (quote ignore) (lambda () #)
(lambda # #f)))
In /opt/gnucash-svn/share/gnucash/guile-modules/gnucash/main.scm:
139: 7 [catch ignore #<procedure #f ()> #<procedure #f (key . args)>]
In unknown file:
?: 8* [#<procedure #f ()>]
In /opt/gnucash-svn/share/gnucash/guile-modules/gnucash/main.scm:
142: 9* [lazy-catch #t #<procedure #f ()> #<procedure dumper (key .
args)>]
In unknown file:
?: 10* [#<procedure #f ()>]
In /opt/gnucash-svn/share/gnucash/guile-modules/gnucash/main.scm:
143: 11* [apply #<procedure #f ()> ()]
In unknown file:
?: 12 [#<procedure #f ()>]
In /opt/gnucash-svn/share/gnucash/scm/report.scm:
...
675: 13 (set! html (gnc:report-render-html report #t))
675: 14* [gnc:report-render-html # #t]
638: 15 (if (and (not #) (gnc:report-ctext report)) (gnc:report-ctext
report) ...)
646: 16 (let ((template #) (doc #f)) (set! doc (if template # #f))
doc)
649: 17* (set! doc (if template (let* (# # # ...) (if #
# ...) ...) ...))
649: 18* (if template (let* (# # # ...) (if # # ...) ...) ...)
650: 19 (let* (# # # #) (if # # #) (gnc:report-set-ctext! report
html) ...)
652: 20* [#f #]
/opt/gnucash-svn/share/gnucash/scm/report.scm:652:35: In expression
(renderer report):
/opt/gnucash-svn/share/gnucash/scm/report.scm:652:35: Wrong type to
apply: #f
What is wrong there?
Valdis
More information about the gnucash-devel
mailing list