This doesn't explain why it IS working for me without the protection you
mention.  "Allocation" is a top level account so I would think the
paretn.total would puke on it, but it doesn't.

I use exactly the format string seen below and it works like a champ.

On Thu, Mar 15, 2012 at 02:07, John Wiegley <[email protected]> wrote:

> >>>>> Jim Robinson <[email protected]>
> writes:
>
> > 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)))
> >                                         ^^^^^^^^^^^^^^
>
> Ah, you need to do something closer to what -% is doing, to be more
> defensive:
>
> %((is_account&parent&parent.total) ? percent(scrub(market(display.total)),
> %scrub(market(parent.total))) : 0)
>
> Parent is null when it gets to "root" account (which contain the final
> total
> at the bottom).
>
> > Apologies if I'm missing something obvious!
>
> I must admit, the solution is far from obvious. :(
>
> John
>



-- 
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

Reply via email to