Aggregate functions (sum, etc.) on Metadata fields?

41 views
Skip to first unread message

TRS-80

unread,
Apr 14, 2019, 1:19:42 AM4/14/19
to bean...@googlegroups.com
Hello Gang,

I have been trying every way I can think of, read all the docs, and searched everything I could find on the internet, and still no joy...

Any help would be greatly appreciated...

Or is this not supported?

TRS-80

TRS-80

unread,
Apr 14, 2019, 11:20:06 AM4/14/19
to bean...@googlegroups.com
I ended up figuring it out, in a roundabout way. I'll try and remember to post the solution later for posterity, but basically I got it close to what I needed using bean-query, and then piped the output of that to awk where I summed the column.

In my case, I needed something that could be scripted. And this did the job.

I'm new to awk but there are tons of cool things you can do with it, especially with structured data.

I would still like an answer on whether this is supposed to be supported or not, because I have searched and searched but maybe I missed it or I dunno what, but I sure as hell haven't been able to figure it out yet (strictly within Beancount tools).

TRS-80

Martin Blais

unread,
Apr 14, 2019, 11:45:36 AM4/14/19
to Beancount
SQL functions not documented but by their source:


plugin "beancount.plugins.auto"

2019-04-10 * ""
  category: "1"
  Assets:Checking  10 USD
  Liabilities:Loan

2019-04-11 * ""
  category: "2"
  Assets:Checking  11 USD
  Liabilities:Loan

2019-04-12 * ""
  category: "1"
  Assets:Checking  13 USD
  Liabilities:Loan

2019-04-13 * ""
  category: "2"
  Assets:Checking  14 USD
  Liabilities:Loan

2019-04-14 * ""
  category: "3"
  Assets:Checking  15 USD
  Liabilities:Loan

2019-05-01 query "test" "select entry_meta('category'), sum(position) where account ~ 'Checking' group by 1"



e sum_po
- ------
1 23 USD
2 25 USD
3 15 USD


--
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 beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/82AB61E5-003C-4203-AFD7-DD21A3903283%40isnotmyreal.name.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages