Register filter for a specific currency

19 views
Skip to first unread message

Paulo Flabiano Smorigo

unread,
Feb 20, 2023, 1:22:15 PM2/20/23
to ledge...@googlegroups.com
Hello,

I have the following entry:

2023-03-15 Entry
Expenses 100.00 USD {= 5 BRL }
Assets:Bank

If I use a currency filter like bellow and the market value, it won't
shows the entry:

ledger -f ./example.ledger --limit "commodity=='BRL'" --market reg Expenses
< no output >

If I use original currency, it will show:

ledger --limit "commodity=='USD'" --market reg Expenses
23-Mar-15 Entry Expenses 500.00 BRL
500.00 BRL

Is this a bug or the expected result? If this is expected, how can I
use a register filter to show only the entries in a specific currency
that also works with --market argument?

Thanks in advance!
--
P. F. Smorigo

Martin Michlmayr

unread,
Feb 20, 2023, 9:37:48 PM2/20/23
to ledge...@googlegroups.com
* Paulo Flabiano Smorigo <pfsm...@gmail.com> [2023-02-20 15:21]:
> Is this a bug or the expected result? If this is expected, how can I
> use a register filter to show only the entries in a specific
> currency that also works with --market argument?

I don't think it's possible at the moment, at least I don't know how.
--
Martin Michlmayr
https://www.cyrius.com/

John Wiegley

unread,
Feb 23, 2023, 2:03:21 PM2/23/23
to Paulo Flabiano Smorigo, ledge...@googlegroups.com
>>>>> "PFS" == Paulo Flabiano Smorigo <pfsm...@gmail.com> writes:

PFS> Is this a bug or the expected result? If this is expected, how can I use
PFS> a register filter to show only the entries in a specific currency that
PFS> also works with --market argument?

It looks like there is no predicate that's "late" enough to catch the
post-market valuation amount, handled by this function:

https://github.com/ledger/ledger/blob/master/src/chain.cc#L108

I thought that instead of --limit you would just need --display or --only, but
those are still not late enough. We may need a fourth type of predicate, like
--finally which only filters at the very end.

John
Reply all
Reply to author
Forward
0 new messages