I saw someone ask an interesting question on reddit, they wanted an
automated transaction to create a mirror transaction in Budget
for every transaction in Expenses.

Obviously you can just do:

= /^Expenses:/
    Budget:$account     -1

That sort-of works, but then you have Budget:Expenses:Foo, when only
Budget:Foo was wanted.

No problem, you can do this instead:

= /^Expenses:/
    Budget:%(account_base) -1

That works for Expenses:Foo, but not Expenses:Foo:Bar....

The best solution I can think of is...

= /^Expenses:[^:]+$/
    Budget:%(account_base)                                        -1
= /^Expenses:[^:]+:[^:]+$/
    Budget:%(account.parent.account_base + ":" + account_base)    -1
= /^Expenses:[^:]+:[^:]+$/
    Budget:%(account.parent.account_base + ":" + account_base)    -1
= /^Expenses:[^:]+:[^:]+:[^:]+$/
    Budget:%(account.parent.parent.account_base + ":" + 
account.parent.account_base + ":" + account_base)  -1

...etc.

Not very elegant, but I think it should work?

Just thought I'd mention it, parent is mentioned in the docs, but only 
parent.total :)

Tavis.

-- 
 _o)            $ lynx lock.cmpxchg8b.com
 /\\  _o)  _o)  $ finger [email protected]
_\_V _( ) _( )  @taviso

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/ledger-cli/100ffjc%243d8%241%40ciao.gmane.io.

Reply via email to