creating accounts by hand in the xml-file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

creating accounts by hand in the xml-file

Andreas Fromm
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I would like to write a tool that creates a list of accounts in
gnucash based on a list of names I pass in. Can I just insert the new
account-subtree into the xml-file without blowing up everything? How
do I get a valid 'act:id' value for a new account?

Regards

Andreas Fromm
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDEuSIUmBtSMq5cGURAof+AJ9joOC3YAwJvgmq/ONS+woOTRl/wgCgxbQF
rVJS5mksIQjqAyblgr2cbtw=
=NOBU
-----END PGP SIGNATURE-----

_______________________________________________
gnucash-devel mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel
Reply | Threaded
Open this post in threaded view
|

Re: creating accounts by hand in the xml-file

Neil Williams-2
On Monday 29 August 2005 11:33 am, Andreas Fromm wrote:
> I would like to write a tool that creates a list of accounts in
> gnucash based on a list of names I pass in.

CashUtil will enable this functionality:

http://www.linux.codehelp.co.uk/cashutil/

It is nowhere near as simple as you may expect.

> Can I just insert the new
> account-subtree into the xml-file without blowing up everything?

No - it's unlikely that you'll find the new accounts when you load the file
because you need to get the relationships and hierarchy in place.

GnuCash will try to ignore accounts that are not correctly inserted - but if
you simply hack the XML it's likely that you'll create a set of account
groups that GnuCash simply cannot understand.

> How
> do I get a valid 'act:id' value for a new account?

1. Create within the GUI.
2. Wait for CashUtil.
3. Write your own QIF format file, possibly.

I can't recommend hacking the XML directly - cashutil loads the XML using
GnuCash C code and the QOF library and this is the only reliable method,
other than the existing GUI.

--

Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/


_______________________________________________
gnucash-devel mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: creating accounts by hand in the xml-file

Josh Sled
In reply to this post by Andreas Fromm
On Mon, 2005-08-29 at 12:33 +0200, Andreas Fromm wrote:
> I would like to write a tool that creates a list of accounts in
> gnucash based on a list of names I pass in. Can I just insert the new
> account-subtree into the xml-file without blowing up everything? How
> do I get a valid 'act:id' value for a new account?

Yes, you can.  It will be important to understand gnucash's concepts of
"type" and "commodity" first.  The accounts form a tree via
parent-pointers (by GUID), so that must be respected.

Account ID's are simply GUIDs; in gnucash, GUIDs are hex-encoded strings
of MD5-generated random values.  They do not have any internal structure
or semantic.  Any sufficiently-random source of data will work to reduce
the chance of natural collisions with existing GUIDs. See [1] for the
gory details.

Certainly, you should only work on a data-file backup and test it out
before entering Important Data.


> Andreas Fromm

...jsled

[1] http://cvs.gnucash.org/cgi-bin/cvsweb.cgi/gnucash/src/engine/guid.c?rev=1.25.4.9;content-type=text%2Fplain

--
http://asynchronous.org/ - `a=jsled; b=asynchronous.org; echo ${a}@${b}`
_______________________________________________
gnucash-devel mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel