[GNC] XML or database?

Kevin Buckley kevin.m.buckley at gmail.com
Mon Nov 7 19:11:19 EST 2022


On Mon, 31 Oct 2022 at 21:32, Derek Atkins <derek at ihtfp.com> wrote:
>
> On Mon, October 31, 2022 9:14 am, R Losey wrote:
> >
> >
> > Long ago in my Quicken days, I would generally keep about 3 years of  data
> > and then "archive" transactions older than that... I don't know if GnuCash
> > has (or needs) any similar feature.
>
> For what it's worth, I have data going back to like 2007 in my file.
> GnuCash does not really have an "archive" function (although there have
> been 3rd party tools that do that.

Whilst there's no explict archive functionality, if you are using XML files,
there's nothing to stop you copying your current file, and then opening
up the copy and removing all transactions before a certain date.

Time consuming, yes: but easily do-able.

Similarly, the ability to export an empty file with the same set of accounts
as your current file, create a report of current balances and enter those
as the "Opening Balances" into you new file, affords a simple way to
effectively archive old transactions into a separate file.

Indeed, if you are prepared to cut and paste XML, it's fairly easy to copy
over the "Scheduled Transction" stanza from the old file to the new one,
and so avoid having to re-enter all of your scheduled transactions all
over again.

Just remember to disable the scheduled transactions in the "archived"
file, or else, the next time you open it up ...

Obviously, the process only applies to the simpler sets of accounts
one might use GnuCash for (I have not tried this for a file that has
any "Business" functionality within it), but here's some "pseudo code"
as your starter for ten:

File->Export-Export Accounts
  using Filename  accounts_new

Creates  accounts_new.gnucash

Open up old file

Grab from

<gnc:template-transactions>

to lthe last

</gnc:schedxaction>
</gnc:book>


Add to end of accounts_new.gnucash


Grab the

<gnc:count-data cd:type="schedxaction">15</gnc:count-data>

count data for the schedexaction

Add after the

<gnc:count-data cd:type="commodity">
<gnc:count-data cd:type="account">

sections in accounts_new.gnucash

Grab the two lines

<gnc:count-data cd:type="book">1</gnc:count-data>
<gnc:book version="2.0.0">


Add after the XML namespace block in accounts_new.gnucash
 so as to balance the closing gnc:book


Then just create the "closing balances" report from the old file
and enter as the new Opening Balances, having opened up
accounts_new.gnucash

HTH,
Kevin


More information about the gnucash-user mailing list