Issue #365: nested field is displayed with its elements in arbitrary order, e.g. SUM(VALUE(position)) (blais/beancount)

16 views
Skip to first unread message

Adam Wolenc

unread,
Jan 20, 2019, 1:34:11 PM1/20/19
to bean...@googlegroups.com
New issue 365: nested field is displayed with its elements in arbitrary order, e.g. SUM(VALUE(position))
https://bitbucket.org/blais/beancount/issues/365/nested-field-is-displayed-with-its

Adam Wolenc:

When displaying a nested target, for example a `SUM` of `position`s containing more than one currency, bean-query displays the elements of this field in arbitrary order. Is there a way to tell it to sort them by currency?

This is best illustrated by an example.
```
#!python
2000-01-04 open Assets:HOOL:Unvested:FUTURE2000 HOOL.UNVEST
2000-01-04 open Income:HOOL:Awards HOOL.UNVEST
2001-01-04 open Assets:HOOL:RSURefund USD
2001-01-04 open Income:HOOL:HoolStockUnit USD

2000-01-04 * "Award FUTURE2000"
Income:HOOL:Awards -10 HOOL.UNVEST
Assets:HOOL:Unvested:FUTURE2000 10 HOOL.UNVEST

2001-01-04 * "Vest FUTURE2000"
Income:HOOL:HoolStockUnit -1000.00 USD
Assets:HOOL:RSURefund

```

Sub accounts under Assets:HOOL now contain two currencies.
Running this query repeatedly results in one of two outputs arbitrarily.

```
#!sql

SELECT ROOT(account, 2) AS institution,
SUM(VALUE(position)) AS mkt
GROUP BY institution
ORDER BY mkt, institution DESC;

```


```
#!
institution mkt
----------- --------------------
Assets:HOOL 10 HOOL.UNVEST, 1000.00 USD
Income:HOOL -10 HOOL.UNVEST, -1000.00 USD

```

```
#!

institution mkt
----------- --------------------
Assets:HOOL 1000.00 USD , 10 HOOL.UNVEST
Income:HOOL -1000.00 USD , -10 HOOL.UNVEST

```


Reply all
Reply to author
Forward
0 new messages