* ledger -j Error: Cannot convert a balance with multiple commodities to an 
amount

** symptoms

I wanted to create some output for graphing, using a command like:

ledger -j -X GBP:EUR bal ^exp

But this raises the error "Cannot convert a balance with multiple 
commodities to an amount"

Similar symptoms are described in a very old bug, although in a different 
context: 
http://bugs.ledger-cli.org/show_bug.cgi?id=378

Is this solvable at all? is this the same root cause?

Below some material for reproducing the issue:

** some transactions
#+name: transactions_multiple_commodities
#+begin_src ledger :noweb yes
P 2013/12/02 17:00:00 GBP €1,2604

C 1,00 EUR = € 1,00

2013/12/02 ACME
    Expenses:A                       € 0,01
    Assets

2014/01/02 ACME
    Expenses:A                       € 1,00
    Assets

2014/01/02 ACME
    Expenses:A                       1,00 GBP
    Assets

2014/02/02 ACME
    Expenses:B                       € 0,01
    Assets

2014/03/02 ACME
    Expenses:B                       € 0,02
    Assets

#+end_src

** a normal register
#+begin_src ledger :cmdline reg ^exp  :noweb yes
<<transactions_multiple_commodities>>
#+end_src  

#+RESULTS:
: 13-Dec-02 ACME                  Expenses:A                   € 0,01       
€ 0,01
: 14-Jan-02 ACME                  Expenses:A                 1,00 EUR     
1,01 EUR
: 14-Jan-02 ACME                  Expenses:A                 1,00 GBP     
1,01 EUR
:                                                                         
1,00 GBP
: 14-Feb-02 ACME                  Expenses:B                   € 0,01     
1,02 EUR
:                                                                         
1,00 GBP
: 14-Mar-02 ACME                  Expenses:B                   € 0,02     
1,04 EUR
:                                                                         
1,00 GBP

** the problematic case

#+begin_src ledger :cmdline -j -X GBP:EUR bal ^exp  :noweb yes
<<transactions_multiple_commodities>>
#+end_src  

#+RESULTS:
: 2015-01-08 0

# error:
While evaluating value expression:
  quantity(scrub(display_amount))
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
While converting 1,01 EUR
1,00 GBP to an amount:
While calling function 'quantity 1,01 EUR
1,00 GBP':
Error: Cannot convert a balance with multiple commodities to an amount

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to