hand-coded transactions are usually BAD transactions

Josh Sled jsled at asynchronous.org
Sat Oct 30 11:41:34 EDT 2004


On Sat, 2004-10-30 at 07:36, Neil Williams wrote:

> By hand? There's no telling the chaos that will result in the QofBook when you 
> arbitrarily insert items. Did you check the GUID? did you create them out of 
> thin air? Did you make any effort to match the GUID of the parent against the 
> GUID of the child?

It's not magic, let alone chaotic.

If you randomly create a GUID [in the expected format, of course] from a
reasonable random-number source, there's a _really_ small chance you'll
create an existing one.  If you want to be paranoid, you could check it
against all known GUIDs in the same dataset.


> > First, is it possible to even do this?
> 
> Not by hand, at least, not without a very high probability of errors.

Sure it is, with a pretty low probability of error...  it's not
recommended, but it is possible:

1/ Look in the datafile and understand the <gnc:transaction> blocks.

2/ Create another one with the correct contraints:
  * The transaction id [<trn:id>] GUID must be unique.
  * The Split [<split:id>] GUID should be, too.
  * The <split:account> guids should reference the appropriate account.
  * The value/quantity should be valid.

But you're probably going to find it easier and safer to just create QIF
files and use the existing import mechanism, as Derek suggested.


> > It looks like there is a transaction count somewhere that
> > I also need to update.  Is that true?

It's informative -- used for the progress bar when GnuCash starts up. 
Increment it by '1' if you create a new transaction, if you care. 
Nothing should blow up if it's wrong.


> > Maybe there are just too many little things
> 
> Links between objects are not 'little' - they are the crux of the GnuCash 
> system.

Yeah, there are a bunch of little things.  It'd be nicer if we had an
XML format setup specifically for GnuCash transaction import.  I have a
desire to do this, but it's a ways off.


In any case: it is possible, though not recommended; you should probably
use the QIF import mechanism.

...jsled

-- 
http://asynchronous.org/ - `a=jsled; b=asynchronous.org; echo ${a}@${b}`


More information about the gnucash-user mailing list