*** Regarding Re: Ok... What's off here? ; [EMAIL PROTECTED] adds:
cbbrowne> It looks like I also have to attach accounts to account
cbbrowne> groups in order for them to exist from the Ledger's point of
cbbrowne> view.
If it's any help, here's what I've been doing in Perl to create
accounts:
gnucash::xaccMallocSession();
gnucash::xaccMallocAccountGroup();
gnucash::xaccSessionBeginFile($session, $fileName);
gnucash::xaccSessionSetGroup($session, $accountGroup);
for each account to be created:
{
gnucash::xaccMallocAccount();
gnucash::xaccInitAccount($account);
gnucash::xaccAccountSetType($account, $type) if defined($type);
gnucash::xaccAccountSetName($account, $name) if defined($name);
gnucash::xaccAccountSetCode($account, $code) if defined($code);
gnucash::xaccAccountSetDescription($account, $description)
if defined($description);
gnucash::xaccAccountSetNotes($account, $notes) if defined($notes);
gnucash::xaccAccountSetCurrency($account, $currency) if defined($currency);
gnucash::xaccAccountSetSecurity($account, $security) if defined($security);
if account is sub account:
{
gnucash::xaccInsertSubAccount($parentAccount, $account);
}
else
{
gnucash::xaccGroupInsertAccount($group, $account);
}
}
gnucash::xaccSessionSave($session);
gnucash::xaccSessionEnd($session);
gnucash::xaccSessionDestroy($session);
This code actually creates a new GnuCash file with the created
accounts. If you are adding new accounts to an already existing file
you have to use xaccSessionGetGroup() to get the top level group
(instead of allocating one and using xaccSessionSetGroup()).
--
Per Bojsen <[EMAIL PROTECTED]>
6132 Lexington Ridge Drive
Lexington, MA 02421-8317
USA
----- %< -------------------------------------------- >% ------
The GnuCash / X-Accountant Mailing List
To unsubscribe, send mail to [EMAIL PROTECTED] and
put "unsubscribe gnucash-devel [EMAIL PROTECTED]" in the body