amend transactions programmatically

Derek Atkins warlord at MIT.EDU
Tue Apr 29 17:18:42 EDT 2008


Hi,

Quoting Tarlika Elisabeth Schmitz <gnucash at numerixtechnology.de>:

> I have hundreds of split transactions, which I would like to "unsplit":
>
> 1 split transaction: net interest + tax = gross interest
>
> =>
>
> 1 debit gross interest
> 2 credit tax

You're not showing the full transaction here, only half.  What's the
other half look like?   How did these transactions get created?  And
why do you want to turn them into multiple transactions?

> I have looked at the XML data file. One should be able to do the change
> programmatically. The only problem I can see is the id string.

You could write a small program to do it, either in C or Scheme,
using the GnuCash API.  The pseudo-code would look something like:

  QofQuery* q;
  GList* splits;

  // XXX: set up Query

  // run the query
  splits = qofQueryRun(q);

  while (splits)
  {
     Split* split = splits->data;

     //  create new transaction and modify this one

     splits = splits -> next;
  }

> Any suggestions would be greatly appreciated.

I'm still not sure exactly why you want to do this.  Are gross interest
and tax credits not happening at the same time?

> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-user mailing list