;doc: journal: account display order: clarify
This commit is contained in:
parent
2de3e6e2dc
commit
f4a8823cf3
@ -1800,10 +1800,9 @@ In [strict mode], enabled with the `-s`/`--strict` flag, hledger will report an
|
|||||||
|
|
||||||
### Account display order
|
### Account display order
|
||||||
|
|
||||||
The order in which account directives are written influences
|
Account directives have another useful function: they cause hledger to display accounts in a particular order, not just alphabetically.
|
||||||
the order in which accounts appear in reports, hledger-ui, hledger-web etc.
|
Eg, here is a conventional ordering for the top-level accounts:
|
||||||
By default accounts appear in alphabetical order,
|
|
||||||
but if you add these account directives to the journal file:
|
|
||||||
```journal
|
```journal
|
||||||
account assets
|
account assets
|
||||||
account liabilities
|
account liabilities
|
||||||
@ -1812,9 +1811,9 @@ account revenues
|
|||||||
account expenses
|
account expenses
|
||||||
```
|
```
|
||||||
|
|
||||||
those accounts will be displayed in declaration order:
|
Now hledger displays them in that order:
|
||||||
```cli
|
```cli
|
||||||
$ hledger accounts -1
|
$ hledger accounts
|
||||||
assets
|
assets
|
||||||
liabilities
|
liabilities
|
||||||
equity
|
equity
|
||||||
@ -1822,19 +1821,15 @@ revenues
|
|||||||
expenses
|
expenses
|
||||||
```
|
```
|
||||||
|
|
||||||
Any undeclared accounts are displayed last, in alphabetical order.
|
If there are undeclared accounts, those will be displayed last, in alphabetical order.
|
||||||
|
|
||||||
Sorting is done at each level of the account tree,
|
Sorting is done within each group of sibling accounts, at each level of the account tree.
|
||||||
within each group of sibling accounts under the same parent.
|
Eg, a declaration like `account parent:child` influences `child`'s position among its siblings.
|
||||||
And currently, this directive:
|
Note to make this work, and/or to influence `parent`'s position, you may need to also declare `account parent`.
|
||||||
```journal
|
|
||||||
account other:zoo
|
|
||||||
```
|
|
||||||
would influence the position of `zoo` among `other`'s subaccounts, but not the position of `other` among the top-level accounts.
|
|
||||||
This means:
|
|
||||||
|
|
||||||
- you will sometimes declare parent accounts (eg `account other` above) that you don't intend to post to, just to customize their display order
|
Sibling accounts are always displayed together; hledger won't display `x:y` in between `a:b` and `a:c`.
|
||||||
- sibling accounts stay together (you couldn't display `x:y` in between `a:b` and `a:c`).
|
|
||||||
|
An account directive both declares an account as a valid posting target, and declares its display order; you can't easily do one without the other.
|
||||||
|
|
||||||
### Account types
|
### Account types
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user