hand-coded transactions are usually BAD transactions

Kevin HaleBoyes khaleboyes at chartwelltechnology.com
Mon Nov 1 10:55:06 EST 2004


Josh Sled wrote:
> 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.

I just replied to Neil's concerns, and there I pointed out that I did
use the GUID from existing transactions that are similar to the ones
I tried to create.

>>>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.

Ok, I think that is what I missed.  The <trn:id> or <split:id> were
not unique in my generated transactions.

> 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.

Derek also suggested that.  It is probably the more sensible way to
approach this.


Thanks for your time,
K.


More information about the gnucash-user mailing list