On Wednesday, March 14, 2012 9:54:00 PM UTC-7, John Wiegley wrote:
>
> >>>>> Jim Robinson writes:
>
> > This is awesome, thanks for writing it up.  I tried it out and found that
> > ledger 3.0.0-20120217 complaints about not understanding the format 
> string 
>
... 
>
> While I did find that this appeared to work:
>
> >   ledger balance -X '$' Allocation --current -%
>
> --percent only works with balance reports.  The error reporting should be
> clearer about this.  Do you have a balance report where it's failing?
>
Well, I was saying that "-%" did work for me using 'balance',
but the --format example did not... So am I doing something
wrong with this example entry below?

$ cat test.txt 
= expr ( commodity == 'VTHRX' )
      (Allocation:Equities:Global)               0.240
      (Allocation:Equities:Domestic)             0.563
      (Allocation:Bonds/Cash)                    0.197

2012-01-01 * Fidelity - 403b Contributions
        Assets:403b:Fidelity:VTHRX               10.000 VTHRX @@  $1,000.00
        Assets:403b:SCRP

So I can get a balance:

$ ledger -f test.txt balance Allocation -X '$'
               $1000  Allocation
                $197    Bonds/Cash
                $803    Equities
                $563      Domestic
                $240      Global
--------------------
               $1000

And I can get a percentage breakdown:

$ ledger -f test.txt balance Allocation -X '$' -%
             100.00%  Allocation
              19.70%    Bonds/Cash
              80.30%    Equities
              70.11%      Domestic
              29.89%      Global

But the format example doesn't like parent.total:

$ ledger -f test.txt balance Allocation --current --format "\
                    %-17((depth_spacer)+(partial_account))\
                    %10(percent(market(display_total), 
market(parent.total)))\
                    %16(market(display_total))\n"
While calculating format expression:
  percent(market(display_total), market((parent.total)))
While evaluating value expression:
  percent(market(display_total), market((parent.total)))
                                        ^^^^^^^^^^^^^^
While calling function 'market <#EXPR (parent.total)>':
While calling function 'percent (<#EXPR market(display_total)>, <#EXPR 
market((parent.total))>)':
Error: Left operand does not evaluate to an object

Apologies if I'm missing something obvious!

Jim

Reply via email to