Dynamically adding reports

Havard Rast Blok nn2 at hblok.net
Thu Jun 11 16:12:10 EDT 2009


This sounds like a useful improvement.

I have a minor comment, which might be a tangent: When using the 
~/.gnucash/config.user to specify "load-from-path" reports, it will not 
work unless the absolute path is specified; e.g. 
"/home/user/.gnucash/reports/myreport.scm". If I use "~/.gnucash/..." 
the report will not load.

Regards,
Havard

Phil Longstaff wrote:
> I played around last night with how reports are loaded in the system.  I basically replaced:
> 
> (use-module (gnucash report report-A))
> (use-module (gnucash report report-B))
> 
> which appears in standard-reports.scm, with
> 
> (define (get-report-list) (list
>     'report-A
>     'report-B
> ))
> (for-each (lambda (x) (resolve-module (append '(gnucash report) x))) (get-report-list))
> 
> which does nothing new, but does allow me to replace (get-report-list) with a function which returns the names of all .scm files.  This will then allow a user/developer to just drop a new report file into the reports directory, restart gnucash, and it will be picked up.  Or, (get-report-list) could read the list of report file names from a standard-report-names.txt file, which would allow the user/developer to drop a report file into the reports directory, add the file name to the standard-report-names.txt, then restart.  My preference is for the former (fewer steps), but a little more difficult.
> 
> The reports directory currently holds all of the report files (both standard and business) as well as some support files.  I think what I will do is create a 'standard-reports' subdirectory to the reports directory, and put the standard reports (or symlinks) there.  get-report-list will then have a single directory from which to get all of the file names.
> 
> Comments?
> 
> Phil
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
> 


More information about the gnucash-devel mailing list