acting on multiple transactions

Dave Peticolas dave@krondo.com
Tue, 24 Apr 2001 13:58:44 -0700


Greg Sullivan writes:
> I want to import transactions from my bank (downloaded qif file) into
> a separate, temporary account, get the corresponding accounts correct
> (categories in qif-speak), then move all the transactions to my main
> bank account.
> 
> I can do this a transaction-at-a-time a few ways:
>   * jump to corresponding transaction and change its transfer field to
>     my main bank acct.
>   * cut transaction from temp register, paste transaction in main bank
>     acct. register.
> 
> I'd like to do the same operation to a bunch of transactions at the
> same time. 
> 
> It seems the most general approach would be to write some Scheme code
> to walk the transactions and move them, but I have no idea how to do
> this (other than knowing Scheme well).
> 
> (1) is there some scheme/guile code I can look at that walks all
>     transactions in an account and does something with them?

The way this is done depends on whether you are using 1.4.x or
the development version. Either way, looking at the wrapped
engine API in src/guile/gnc.html is helpful.


> (2) let's say I had just the right Scheme/Guile code -- how do I apply
>     it to an account from within gnucash?  Do I have to make a new
>     menu item?  If so, it would be nice to have "load scheme file" and
>     "run scheme function" general purpose menu items.

For both versions, you can add a menu item whose callback invokes
a scheme thunk. See src/scm/extensions.scm. For the development
version, you can also specify a scm file to load with --load.

dave