Open tbm opened 1 year ago
It is not difficult to add support for the WHERE
clause to PRINT
. However, PRINT
is implicitly a query on the transactions
table, thus the WHERE
clause can be applied only to fields available in transactions
table, not from the postings
table.
I would like to bring the semantics of PRINT
closer to standard SQL, maybe transforming it in a form of SELECT
that implicitly selects a query rendering format of type beancount
, but there are many transformation of the beanquery internals that are required to get there, and I don't have a clear path defined yet.
Once that is done, one way to solve this is to have another form of the PRINT
statement that looks something like this:
PRINT entry FROM #postings WHERE account ~ 'Income:Donations' AND number < -100
Thanks for your explanation. That sounds great!
It seems like
print
only supportsfrom
. What do you think of addingwhere
toprint
and how hard would it be?Ledger allows this and this is a great feature - seeing the original transaction only for certain queries.
One use case: when I import txns from PayPal for a non-profit, I check for donations larger than a certain amount because I want to look more closely (is it really an unsolicited donation or some kind of sponsorship/receivable) , e.g.
SELECT * WHERE ACCOUNT ~ 'Income:Donations' AND number < -100
, but when I want to look at the whole transaction to see all the meta-data and stuff and so aPRINT
with thisWHERE
query would be really useful.