On Sat, Dec 31, 2016 at 2:40 PM, Jakob Mattsson <[email protected]>
wrote:

> Yeah, I've been doing something along those lines (slightly altering the
> names of my accounts) to get it to the order I want - or close at least.
>
> What I think would be more elegant is being able to sort on something that
> would produce the desired result, rather than relying on account names
> (except as a default behavior of course) . For example, from the docs:
>
> --sort VEXPR-S VEXPR
> Sort a report by comparing the values determined using the value
> expression VEXPR. For example, using ‘-S "-abs(total)"’ in the balance
> report will sort account balances from greatest to least, using the
> absolute value of the total. For more on how to use value expressions,
> see Value Expressions
> <http://www.ledger-cli.org/3.0/doc/ledger3.html#Value-Expressions>.
>
> Now, this can clearly sort on the amount in the accounts. Imagine if we
> could sort on some other property belonging to an account. For example, it
> could be on the "note" associated with an account (and the number you
> suggested could be put as the first thing in there), or some other more
> arbitrary data.
>
> Is this something anyone else would find useful? Or is there even a way to
> do something similar already?
>

Not Ledger, but Beancount can do this with metadata attached to an
account's open directives:
bean-query mattson.beancount "select account, getitem(open_meta(account),
'num') as num, sum(position) group by 1, 2 order by 2"


1980-05-12 open Equity:Opening-Balances
  num: 5000
1980-05-12 open Liabilities:AccountsPayable
  num: 2000

1980-05-12 open Expenses:Financial:Fees
1980-05-12 open Expenses:Home:Electricity
  num: 3004
1980-05-12 open Expenses:Home:Internet
  num: 3000
1980-05-12 open Expenses:Home:Phone
  num: 3002
1980-05-12 open Expenses:Home:Rent
  num: 3001


2013-01-01 open Assets:US:BofA
  address: "123 America Street, LargeTown, USA"
  institution: "Bank of America"
  phone: "+1.012.345.6789"

2013-01-01 open Assets:US:BofA:Checking                        USD
  num: 1000
  account: "00234-48574897"

2013-01-01 * "Opening Balance for checking account"
  Assets:US:BofA:Checking                         3219.17 USD
  Equity:Opening-Balances                        -3219.17 USD

2013-01-02 balance Assets:US:BofA:Checking        3219.17 USD

2013-01-06 * "RiverBank Properties" "Paying the rent"
  Assets:US:BofA:Checking                        -2400.00 USD
  Expenses:Home:Rent                              2400.00 USD

2013-01-09 * "EDISON POWER" ""
  Assets:US:BofA:Checking                          -65.00 USD
  Expenses:Home:Electricity                         65.00 USD

2013-01-20 * "Verizon Wireless" ""
  Assets:US:BofA:Checking                          -69.82 USD
  Expenses:Home:Phone                               69.82 USD

2013-01-22 * "Wine-Tarner Cable" ""
  Assets:US:BofA:Checking                          -79.85 USD
  Expenses:Home:Internet                            79.85 USD

2013-02-05 * "RiverBank Properties" "Paying the rent"
  Assets:US:BofA:Checking                        -2400.00 USD
  Expenses:Home:Rent                              2400.00 USD

2013-02-09 * "EDISON POWER" ""
  Assets:US:BofA:Checking                          -65.00 USD
  Expenses:Home:Electricity                         65.00 USD

2013-02-20 * "Verizon Wireless" ""
  Assets:US:BofA:Checking                          -46.32 USD
  Expenses:Home:Phone                               46.32 USD




>
>
>
>
>
>
> On Saturday, December 31, 2016 at 9:29:04 AM UTC-10, Craig Earls wrote:
>>
>> How is ledger supposed to know the characteristics of the commodities in
>> the accounts?
>>
>> Ledger just sees account names as a string of characters, it does not
>> treat an account that starts with "asset" or "Vermögenswert" any
>> differently than any other account.  It does not know how liquid or
>> illiquid the commodities in an account are.
>>
>> One way to control this is to name your account in the order in which you
>> want them presented.
>>
>> For example:
>>
>> 00001 Assets:00001 Least Liquid
>> 00001 Assets:00002 Next Least Liquid
>>
>> 00002 Liabilities:00001 Soonest
>> 00002 Liabilities:00002 Next Soonest
>>
>> etc.
>>
>>
>> I can see that this would quickly get cumbersome, but some additional
>> code written for editing and displaying could help this.  Like stripping
>> out the 0000X in the output.  The numbers don't have to be consecutive
>> either, just in the sort order you want.
>>
>> On Sat, Dec 31, 2016 at 12:20 PM, Jakob Mattsson <[email protected]>
>> wrote:
>>
>>> Hi all,
>>>
>>> I have a little pet peeve regarding balance reports. As you might know,
>>> a balance sheet is usually organized with assets at the top, from the least
>>> liquid to the most liquid, followed by liabilities/equities, from the most
>>> immediate to be paid to the least immediate.
>>>
>>> In ledger-cli the output of the balance command is sorted by account
>>> names.
>>>
>>> Is there a way to control this output order, so it can more closely
>>> resemble "the usual" ordering in a balance sheet?
>>>
>>>
>>>
>>>
>>> --
>>>
>>> ---
>>> 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.
>>>
>>
>>
>>
>> --
>> Craig, Corona De Tucson, AZ
>> [image: missile_flyout]
>> enderw88.wordpress.com
>>
> --
>
> ---
> 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.
>

-- 

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