How to remove all txns from an Account?
Derek Atkins
warlord at MIT.EDU
Tue Apr 15 13:56:34 EDT 2008
Hi,
I think the real question is.. What EXACTLY are you trying to do?
What I would do:
xaccAccountTreeForEachTransaction(acc, get_txn_list_cb, &txn_list);
foreach (txn_list)
delete txn.
But I don't know why you'd ever want to do this.
-derek
"Charles Day" <cedayiv at gmail.com> writes:
> What is the proper way to destroy all transactions that involve a particular
> account?
>
> I tried using xaccAccountTreeForEachTransaction(), but that uses
> xaccAccountStagedTransactionTraversal() which has a limitation in that it
> assumes that no splits are being removed from the account. Is this
> limitation intentional?
>
> So for example, the following code doesn't work and actually can cause
> crashes:
>
> /* Remove all the transactions in this account and its descendants. */
> xaccAccountTreeForEachTransaction(acc, remove_transaction_cb, NULL);
>
> ---where remove_transaction_cb is defined as the following---
>
> static gint
> remove_transaction_cb(Transaction * trans, void * data)
> {
> /* Destroy the transaction. */
> xaccTransDestroy(trans);
>
> return 0;
> }
>
> Cheers,
> Charles
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
>
--
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-devel
mailing list