Skip to content

balance with full account paths and unused accounts #2429

Closed

Description

@thielema

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.

Activity

  1. added
    A-WISHSome kind of improvement request or proposal.
    fodsThe FODS output format.
    on Jul 16, 2025
  2. thielema commented on Jul 27, 2025

    @thielema
    ContributorAuthor

    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?

  3. thielema commented on Jul 15, 2026

    @thielema
    ContributorAuthor

    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.

  4. simonmichael commented on Jul 30, 2026

    @simonmichael
    Member

    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:

    1. A way to report the full names and balances of accounts and their parents
    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.

    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.

  5. simonmichael commented on Jul 30, 2026

    @simonmichael
    Member

    The test failure is persisting; I'll dig into that later.

  6. simonmichael commented on Jul 30, 2026

    @simonmichael
    Member

    Actually the test failure seems to be genuine, caused by 2662. It can be reproduced locally with stack test hledger-ui.

  7. thielema commented on Jul 30, 2026

    @thielema
    ContributorAuthor
  8. thielema commented on Jul 30, 2026

    @thielema
    ContributorAuthor
  9. thielema commented on Aug 3, 2026

    @thielema
    ContributorAuthor
  10. simonmichael commented on Aug 3, 2026

    @simonmichael
    Member

    Can't hledger-ui just avoid ever using --no-elide, and work as before ?

  11. simonmichael commented on Aug 3, 2026

    @simonmichael
    Member

    Oh I see, it uses it when displaying accounts in tree mode.

  12. simonmichael commented on Aug 11, 2026

    @simonmichael
    Member

    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:

    #2661 --full-path
    (or --full-names)
    #2662 --no-elide in flat mode
    Blast radius Balance.hs rendering only hledger-lib report logic — affects ui, web, budget
    Follow-on damage (as submitted) none needed a hledger-ui fix; -E/--empty becomes a no-op
    Flags needed 3: --tree --no-elide --full-path 2: --flat --no-elide
    Text output not covered (inconsistently, budget is) works
    csv/fods (the #2429 use case) works works
    --drop N clean repeated ... rows
    -S sorting tree sort, parents keep children flat sort, can interleave parents/children
    Amount semantics tree-mode inclusive, unchanged flat-mode amounts become inclusive of subaccounts
    New surface one new flag none

    If you don't object, I might let it try fixes for 2662, then do some testing with that.

  13. simonmichael commented on Aug 11, 2026

    @simonmichael
    Member

    I might let it try fixes for 2662

    I did that. And, shared as the 2662-fixes branch.

    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 ?

  14. thielema commented on Aug 11, 2026

    @thielema
    ContributorAuthor

    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.

  15. simonmichael commented on Aug 11, 2026

    @simonmichael
    Member

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

  16. thielema commented on Aug 11, 2026

    @thielema
    ContributorAuthor
  17. simonmichael commented on Aug 11, 2026

    @simonmichael
    Member

    #2688 solves this, hopefully.

  18. added a commit that references this issue on Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WISHSome kind of improvement request or proposal.balancefodsThe FODS output format.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions