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

```


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20190120183410.26168.85428%40app-147.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to