On 19/10/2022 17:12, Stefano Zacchiroli wrote:
I'm trying to filter postings based on whether the corresponding amount
is positive or negative, e.g.:
select position where account ~ "^Expenses:Medical" and value(position) > 0;
but this fails with:
error: Operator greater(Amount, int) not supported
(using today's beanquery from git master branch).
I understand an Amount is not an integer, but a (number, currency)
pair. But I don't know how to peak into the number field using BQL.
Any suggestion?
You can use the number() function to get the number part of an Amount:
SELECT
position
WHERE
account ~ "^Expenses:Medical" AND
number(value(position)) > 0
Cheers,
Dan
--
You received this message because you are subscribed to the Google Groups
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/a40cd3e4-b55f-ddae-7b9b-bd69f80d926e%40grinta.net.