changing a large number of transactions in a batch -- impossible?

Derek Atkins warlord at MIT.EDU
Mon Aug 20 10:39:23 EDT 2012


Hi,

"Anna's unattended mail" <anna.morris-1okt59qe at cool.fr.nf> writes:

> On 2012-08-16, David T. <sunfish62 at yahoo.com> wrote:
>>
>> First, open the register with the erroneous transactions in it, and
>> set the view to Transaction Journal view. Next, get to the split of
>> a transaction you want to change, and change it.
>
> I appreciate the feedback from you and Derek.  Your approach is
> probably the fastest manual way of doing it, but still quite tedious
> for more than 50 transactions, particularly if non-sequential.  If a
> batch of transactions with descriptions matching a string are to be
> moved, and the batch size is in the hundreds or thousands, I've found
> that hacking the XML is (unfortunately) the only practical way.

That begs the question of how you got hundreds or thousands of
transactions input with the wrong data in the first place?  Perhaps the
right time to fix it would be when you enter the data?

> Suppose your business books are mixed with your personal books, and

This is already a bad idea....

> you want to create the separation that should have existed initially,
> but didn't.  If all transactions containing "Netflix" are not business
> related, this is how I would delete them:
>
>   tr '\n' '^' < business_and_personal.gnucash |
>     sed 's/\^.gnc:trans/\n<gnc:trans/g' |
>     grep -vi '^.....transaction.*netflix.*transaction.$' |
>     tr '^' '\n' > business.gnucash
>
> This works only because the caret ("^") character does not appear
> anywhere in my gnucash file, so it can be used to temporarily replace
> the newlines.  If anyone else attempts this, they should verify that
> "grep -c '\^' file.gnucash" is zero first.
>
> Wasn't there some talk a while back about gnucash using sql instead?
> That would seem to have more utility than XML, making it easier to
> make batch changes that tools do not support.

Not necessarily any easier.  And we DO have a SQL backend available, but
it's not recommended for real data yet because people keep finding data
integrity bugs in it.  We don't have a good test suite to make sure
every API actually works with every backend.  So these bugs only get
found when some poor user loses data and complains.  :-(

> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-user mailing list