Automated expressions and ledger 3.0

62 views
Skip to first unread message

Gabriel Kerneis

unread,
Nov 9, 2009, 7:58:27 AM11/9/09
to ledge...@googlegroups.com
Hi,

I cannot use automated expressions in master-0-g55c7792.

This used to work in ledger 2.6:
========================================================
= /^Assets:Bank:Visa/
Assets:Bank:Visa -1
Assets:Bank:Checking 1
========================================================

I tried to translate it to ledger 3.0:
========================================================
= account =~ /^Assets:Bank:Visa/
Assets:Bank:Visa -1
Assets:Bank:Checking 1
========================================================
But nothing is inserted. I must have missed something (the documentation
is very sparse about this change ;-).

BTW, I use this transaction because I want to keep track of the
transactions I pay using my credit card. Here, in France, credit cards
are bound to checking accounts, it's more a payment card than a credit
card in fact, so it doesn't make sense to put it in Liabilities. This
transaction allows me to distinguish between checks and credit card
payments, while keeping everything subtracted from the (real) checking
account in the end. If you have a better solution, I'd be glad to hear
about it (I tried virtual accounts, but couldn't find a proper way of
doing it).

Regards,
--
Gabriel Kerneis

John Wiegley

unread,
Nov 9, 2009, 7:49:29 PM11/9/09
to ledge...@googlegroups.com
Hi Gabriel,

I'm able to reproduce your bug here and will have it fixed shortly.

Also, I'm thinking of allowing an alternate syntax for automated
expression, that allows you to use the same report query syntax as the
command line. That way you could just say:

== Bank:Visa

I would either put this behind "==", or make it the default syntax for
"=". The reason being that you could always use full expressions via:

= expr account =~ /^Assets:Bank:Visa/

But I think that the majority of people used automated transaction
simply to match on account names, and it seems awkward to require the
full value expression syntax in this case.

John

Gabriel Kerneis

unread,
Nov 10, 2009, 3:43:52 AM11/10/09
to ledge...@googlegroups.com
Hi,

On Mon, Nov 09, 2009 at 01:58:27PM +0100, Gabriel Kerneis wrote:
> BTW, I use this transaction because I want to keep track of the
> transactions I pay using my credit card. Here, in France, credit cards
> are bound to checking accounts, it's more a payment card than a credit
> card in fact, so it doesn't make sense to put it in Liabilities. This
> transaction allows me to distinguish between checks and credit card
> payments, while keeping everything subtracted from the (real) checking
> account in the end. If you have a better solution, I'd be glad to hear
> about it (I tried virtual accounts, but couldn't find a proper way of
> doing it).

In the meantime, I realized that using subaccounts is a better choice
in my case: Bank:Main:Visa and Bank:Main:Check works very well.

Anyway, thank you for your quick answer and fix!

Regards,
--
Gabriel Kerneis

John Wiegley

unread,
Nov 10, 2009, 3:45:27 AM11/10/09
to ledge...@googlegroups.com
On Nov 9, 2009, at 7:49 PM, John Wiegley wrote:

> Also, I'm thinking of allowing an alternate syntax for automated
> expression, that allows you to use the same report query syntax as
> the command line. That way you could just say:

This has been implemented, so that you can now use any of the three
following forms for automated expressions:

= Food

= /Food/ ; this is the 2.x style

= expr account =~ /Food/

John

Reply all
Reply to author
Forward
0 new messages