using account.parent in expressions

59 views
Skip to first unread message

Tavis Ormandy

unread,
May 19, 2025, 10:35:41 AMMay 19
to ledge...@googlegroups.com
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 tav...@sdf.org
_\_V _( ) _( ) @taviso

Reply all
Reply to author
Forward
0 new messages