hledger icon indicating copy to clipboard operation
hledger copied to clipboard

hledger bal history printout based on transactions rather than fixed time periods

Open LaurenzWiskott2 opened this issue 3 years ago • 5 comments
trafficstars

Following the issue 1776

I find the hledger bal history printout very useful, generated with something like hledger bal "accountA" --begin 2020 -Q --transpose --drop 5 --historical -S. I think it would be great if there were an option to plot the history listing every transaction rather than just summaries of time periods. Should be easy to do and not complicate the options too much. Beside the options --daily, -monthly, etc. one would need something like --transactions. Might actually be good to have that in general for the --period specifier, so that one could, e.g., write -p "every transaction from 2009-05-05 to 2009-06-01". I think that would be great.

LaurenzWiskott2 avatar Dec 08 '21 16:12 LaurenzWiskott2

Could you give an example of the output you would like to see based on a small example journal? I don't quite understand your request at the moment.

Have you tried the aregister command? This sounds like it might be similar to what you're looking for.

Xitian9 avatar Dec 13 '21 20:12 Xitian9

aregister can only process a single account and not a group of accounts. It thus does not offer what I need.

I think the simplest way to achieve very close to what I want is to add a flag (e.g. --skip-idle-periods) that suppresses lines in a periodic balance report where nothing changes. Assume I have accounts aaccount, baccount, and caccount and want an overview over all net transactions for the combination of (aaccount|baccount) but not caccount, one line per transaction. Then I could use something like

hledger bal "(aaccount|baccount)" -d --skip-idle-periods --transpose --drop 5

to at least approximate that.

Even better (but presumably more difficult to implement) would be my suggestion above with a --transactions option, which would really print one line per transaction and not per day, or my suggestions in issue 1776.

LaurenzWiskott2 avatar Dec 25 '21 10:12 LaurenzWiskott2

If I understand correctly, you're basically looking for a version of the register command which keeps different accounts separate in different columns. Is this correct?

That seems like it would become very sparse very quickly, would it not? Almost every transaction would have at most two accounts, so each row would generally only have two non-zero entries.

Am I understanding your request correctly?

Xitian9 avatar Dec 25 '21 13:12 Xitian9

No, my main original goal in issue 1776 was to be able to print out a record of transactions, one line per transaction, for an arbitrarily defined group of accounts. aregister gives me one line per transaction, but it does not allow me to group accounts. register allows me to group accounts, but it gives me multiple lines per transaction, which I find difficult to read. The idea with a periodic register command commented on in this thread was an attempt to find a workaround.

LaurenzWiskott2 avatar Dec 25 '21 13:12 LaurenzWiskott2

Could you please give an example of what you're trying to accomplish, preferably with a mock-up? This sounds like it can be accomplished with account aliases, but I can't say for certain.

Xitian9 avatar Dec 25 '21 15:12 Xitian9