querying on amount

26 views
Skip to first unread message

Jeff Abrahamson

unread,
Aug 18, 2019, 10:51:12 AM8/18/19
to ledge...@googlegroups.com

I find myself wanting to query on transaction amounts.

] reg amount 7.53
...see all transactions that have (credit or debit or both with) value 7.53...
]

I've read the docs through twice, I'm not seeing it.  Is this not possible or did I miss it?

Thanks.

-- 

Jeff Abrahamson
+33 6 24 40 01 57
+44 7920 594 255
https://www.p27.eu/jeff/
https://www.transport-nantes.com/

Martin Michlmayr

unread,
Aug 18, 2019, 10:54:10 AM8/18/19
to ledge...@googlegroups.com
* Jeff Abrahamson <je...@p27.eu> [2019-08-18 16:51]:
> I find myself wanting to query on transaction amounts.
>
> ] reg amount 7.53
> ...see all transactions that have (credit or debit or both with)
> value 7.53...
> ]
>
> I've read the docs through twice, I'm not seeing it.  Is this not
> possible or did I miss it?

You can do -l "amount == ..."

ledger -f d reg -l "amount == 7.53 EUR"

or if you want both credit and debits:

ledger -f d reg -l "abs(amount) == 7.53 EUR"

Example:

2018-01-01 * foo
A 7.53 EUR
B

2018-01-01 * Refund
A -7.53 EUR
B

ledger -f d reg A -l "abs(amount) == 7.53 EUR"
2018-01-01 foo A 7.53 EUR 7.53 EUR
2018-01-01 Refund A -7.53 EUR 0

--
Martin Michlmayr
https://www.cyrius.com/

Craig Earls

unread,
Aug 18, 2019, 11:23:04 AM8/18/19
to ledge...@googlegroups.com
—limit “(amount==7.53)”

--

---
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 ledger-cli+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/1bcc5720-3e03-3d1e-81e4-cce93be331c3%40p27.eu.
--
Craig, Corona De Tucson, AZ
missile_flyout
enderw88.wordpress.com

John Wiegley

unread,
Aug 18, 2019, 1:20:55 PM8/18/19
to Martin Michlmayr, ledge...@googlegroups.com
>>>>> "MM" == Martin Michlmayr <t...@cyrius.com> writes:

MM> ledger -f d reg -l "amount == 7.53 EUR"

You can even see all of the postings from every transaction where at least one
of those postings was of a specific amount:

-l "any(amount == 7.53 EUR)"

John
Reply all
Reply to author
Forward
0 new messages