You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
balance with full account paths and unused accounts #2429
I want to do the following: Write a balance report to a FODS file, load this FODS into LibreOffice Calc and append the table to another table, that accesses the numbers from the balance report. I want to access the balance report numbers with the LibreOffice function VLOOKUP (in the German version: SVERWEIS). For proper lookup, VLOOKUP needs the full account name, as provided by the list mode of hledger-balance. However, the list mode misses the amounts for parent accounts. Thus what I want is all the lines and numbers from the tree mode, but the account names written as in the list mode.
This wish is similar to #1550 but I do not want indentation. But I guess, VLOOKUP can be made to tolerate the indentation.
For now I work around the missing functionality by creating multiple balance reports in list mode, but with depths 2, 3, 4.
What I also need is that unused accounts are reported anyway, but with amount zero. This is for accounts that are unused in one year, but exist for transactions in other years. I consider an account existing if there is any transaction that refers to that account or if there is an explicit account declaration.
I have wondered, whether I should add full account paths as option to tree mode or whether I should add parent accounts to list mode. It turns out that adding paths to tree mode in the code is much simpler.
What would be a good name for such an option?
Let me give a simplified example. The tree view of accounts in CSV/FODS may look like this:
Expense, -1000 Euro
Rent, -1000 Euro
Revenue, 800 Euro
Rent, 600 Euro
Doe, 300 Euro
Miller, 300 Euro
Operating, 200 Euro
Doe, 100 Euro
Miller, 100 Euro
The list view instead looks like this:
Expense:Rent, -1000 Euro
Revenue:Rent:Doe, 300 Euro
Revenue:Rent:Miller, 300 Euro
Revenue:Operating:Doe, 100 Euro
Revenue:Operating:Miller, 100 Euro
I want to include the FODS table into a LibreOffice calc spreadsheet and access, say, the Revenue:Rent number, i.e. 600 Euro, using the VLOOKUP function. The List View misses that number, whereas the Tree View has the number, but only with unqualified name Rent, which is ambiguous.
The --full-path option adds the full account paths to the account names in the Tree Mode.
A way to report the full names and balances of accounts and their parents
A way to include accounts which are declared or active outside the report period, even if they are not active in the report period.
2661 and 2662 address 1, by adding a new flag or by using --no-elide, respectively. I think 2662 although draft is.. working ? and failed CI only because of something unrelated.
2 does not yet have a solution and is anyway separate from this issue.
On Thu, 30 Jul 2026, Simon Michael wrote:
2. A way to include accounts which are declared or active outside the report period, even if they are not active in
the report period.
I am still working on those issues. Currently, I do see via 'trace' that
markAccountBoring is only called on the root account not on all accounts.
I expected that it is called on every account and its parent accounts.
Surprisingly, it works for the tree mode but not for flat mode.
On Thu, 30 Jul 2026, Simon Michael wrote:
[10144?s=20&v=4] simonmichael left a comment (hledgerorg/hledger#2429)
Actually the test failure seems to be genuine, caused by 2662. It can be
reproduced locally with stack test hledger-ui.
On Thu, 30 Jul 2026, Simon Michael wrote:
[10144?s=20&v=4] simonmichael left a comment (hledgerorg/hledger#2429)
Actually the test failure seems to be genuine, caused by 2662. It can be
reproduced locally with stack test hledger-ui.
I can now reproduce the problem. The former version of hledger-ui listed
assets:checking $1480
and thus pressing "cursor right" twice descended into "assets:checking",
showing three transactions.
With the new effect on "--no-elide" in list mode, we get instead:
assets $1480
assets:checking $1480
and pressing "cursor right" twice descends into "assets" which is empty.
I remember that hledger-ui uses "--empty" per default.
What do you propose as the right behavior, the right way to fix the issue?
I did an AI-assisted review of the latest #2662. A number of issues were found - interactions with -E, with --drop, with -S, and doc updates needed.
And there was some agreement with you that in some ways a separate flag is cleaner, and less invasive. So I analysed #2661 as well. A few minor UX issues were found.
Both seem to have some issues fitting in a way that feels consistent. It's hard to see a clear winner. Here's a comparison:
Ignoring case 2 above (accounts with no activity during the report period) - even so, I'm not sure this fully meets your need ? It can list
inclusive amounts: all accounts active during the period, and their parents, with full names, and their inclusive amounts, even if zero (bal --no-elide -E)
exclusive amounts: all accounts active during the period, with full names, and their exclusive amounts, even if zero (bal -E)
but it still doesn't allow listing all parent accounts with their exclusive amounts. Is that something you need ?
I do not need parent accounts with exclusive amounts. Generally I think it is a bad account structure if an account with sub-accounts has postings itself. Those should be better placed in an "others" sub-account.
(Also, in the inclusive-amounts case, parents are still hidden when their inclusive amount is zero, even with -E. So it seems there's still no way to guarantee a fully populated table of all (active) accounts and all parents, with full names (with either inclusive or exclusive amounts).)
Generally I think it is a bad account structure if an account with sub-accounts has postings itself.
Perhaps, but for generality I think we should keep supporting it.
After some more experimentation.. I'm cooling on 2662. bal --no-elide makes list mode show inclusive amounts, which goes against tradition. For many years, tree mode has shown inclusive amounts and list mode has shown exclusive amounts (except where clipped by --depth).
Something building on 2661 is sounding better. And I'm sorry for making unnecessary work for you. I hope you won't mind if I keep noodling on this.
On Tue, 11 Aug 2026, Simon Michael wrote:
[10144?s=20&v=4] simonmichael left a comment (hledgerorg/hledger#2429)
After some more experimentation.. I'm cooling on 2662. bal --no-elide
makes list mode show inclusive amounts, which goes against tradition.
For many years, tree mode has shown inclusive amounts and list mode has
shown exclusive amounts (except where clipped by --depth).
This sounds like a strong argument against re-using --no-elide for what I
need.
Something building on 2661 is sounding better. And I'm sorry for making
unnecessary work for you. I hope you won't mind if I keep noodling on
this.
I am happy if we find a solution that is consistent.
I am also trying to make --declared show parents of declared but
(temporarily) empty accounts, cf. my post to google groups. I try to use
--no-elide for that, but maybe --full-path is the better option for that
one, too.
Activity
thielema commentedon Jul 27, 2025
I have wondered, whether I should add full account paths as option to tree mode or whether I should add parent accounts to list mode. It turns out that adding paths to tree mode in the code is much simpler.
What would be a good name for such an option?
thielema commentedon Jul 15, 2026
Let me give a simplified example. The tree view of accounts in CSV/FODS may look like this:
The list view instead looks like this:
I want to include the FODS table into a LibreOffice calc spreadsheet and access, say, the Revenue:Rent number, i.e. 600 Euro, using the
VLOOKUPfunction. The List View misses that number, whereas the Tree View has the number, but only with unqualified nameRent, which is ambiguous.The
--full-pathoption adds the full account paths to the account names in the Tree Mode.simonmichael commentedon Jul 30, 2026
If I understand it rightly: this (issue #2429) use case has spawned pr #2661, draft pr #2662, and mail list thread https://groups.google.com/g/hledger/c/X4oeHS2ANjc. There are two main things wanted:
2661 and 2662 address 1, by adding a new flag or by using --no-elide, respectively. I think 2662 although draft is.. working ? and failed CI only because of something unrelated.
2 does not yet have a solution and is anyway separate from this issue.
simonmichael commentedon Jul 30, 2026
The test failure is persisting; I'll dig into that later.
simonmichael commentedon Jul 30, 2026
Actually the test failure seems to be genuine, caused by 2662. It can be reproduced locally with
stack test hledger-ui.thielema commentedon Jul 30, 2026
thielema commentedon Jul 30, 2026
thielema commentedon Aug 3, 2026
simonmichael commentedon Aug 3, 2026
Can't hledger-ui just avoid ever using --no-elide, and work as before ?
simonmichael commentedon Aug 3, 2026
Oh I see, it uses it when displaying accounts in tree mode.
simonmichael commentedon Aug 11, 2026
I did an AI-assisted review of the latest #2662. A number of issues were found - interactions with -E, with --drop, with -S, and doc updates needed.
And there was some agreement with you that in some ways a separate flag is cleaner, and less invasive. So I analysed #2661 as well. A few minor UX issues were found.
Both seem to have some issues fitting in a way that feels consistent. It's hard to see a clear winner. Here's a comparison:
--full-path(or
--full-names)--no-elidein flat mode-E/--emptybecomes a no-op--tree --no-elide --full-path--flat --no-elide--drop N...rows-SsortingIf you don't object, I might let it try fixes for 2662, then do some testing with that.
simonmichael commentedon Aug 11, 2026
I did that. And, shared as the
2662-fixesbranch.Ignoring case 2 above (accounts with no activity during the report period) - even so, I'm not sure this fully meets your need ? It can list
bal --no-elide -E)bal -E)but it still doesn't allow listing all parent accounts with their exclusive amounts. Is that something you need ?
thielema commentedon Aug 11, 2026
I do not need parent accounts with exclusive amounts. Generally I think it is a bad account structure if an account with sub-accounts has postings itself. Those should be better placed in an "others" sub-account.
simonmichael commentedon Aug 11, 2026
(Also, in the inclusive-amounts case, parents are still hidden when their inclusive amount is zero, even with -E. So it seems there's still no way to guarantee a fully populated table of all (active) accounts and all parents, with full names (with either inclusive or exclusive amounts).)
Perhaps, but for generality I think we should keep supporting it.
After some more experimentation.. I'm cooling on 2662.
bal --no-elidemakes list mode show inclusive amounts, which goes against tradition. For many years, tree mode has shown inclusive amounts and list mode has shown exclusive amounts (except where clipped by --depth).Something building on 2661 is sounding better. And I'm sorry for making unnecessary work for you. I hope you won't mind if I keep noodling on this.
thielema commentedon Aug 11, 2026
imp:bal: rename --full-path to --full-names; txt support; docs; tests (…
imp:bal: in list mode, --no-elide with -E shows parent accounts (#2429)
imp:bal: rename --full-path to --full-names; make it work in txt outp…
simonmichael commentedon Aug 11, 2026
#2688 solves this, hopefully.
Merge pull request #2688 from simonmichael/2688