>>>>> 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

Reply via email to