hledger icon indicating copy to clipboard operation
hledger copied to clipboard

`bal -O csv --layout tidy` ignores --transpose

Open simonmichael opened this issue 3 years ago • 4 comments

simonmichael avatar Jul 08 '22 03:07 simonmichael

I think ignoring --transpose is the right behaviour.

For normal csv output, the rows are indexed by account name, and the columns by datespan. --transpose changes this so the rows are indexed by datespan and the columns by account name, which is right and good.

However, with tidy csv output, the rows are indexed by an account name–datespan pair, and transposing would give exactly the same output. You might be seeing multiple dates in the tidy csv output and think those are different columns, but they're just three different parts of representing a single datespan: the pretty text form, the start date in iso format, and the end date in iso format.

Another way to look at this: normal csv output is a two-dimensional matrix, which can be transposed. But tidy csv output is a flattened list obtained from the matrix, which is one-dimensional and does not have an interesting transposition.

Xitian9 avatar Jul 08 '22 12:07 Xitian9

Cool, so --transpose and --layout=tidy are incompatible. We should give an error when they are combined, perhaps,

simonmichael avatar Jul 08 '22 15:07 simonmichael

I wouldn't say they're incompatible, just that transposing is the identity on tidy layout. Maybe we could throw an error, but I generally think those should be reserved for when the the result is nonsense.

I think of it like calling -V when there are no price declarations. In that case, you value everything, and the result is that nothing changes. That's correct, and we wouldn't throw an error saying ‘cannot use -V when there are no price declarations’, we would just display the unvalued report as usual, because it's identical to the valued report.

Xitian9 avatar Jul 08 '22 22:07 Xitian9

Ah, fair enough. So we should do nothing , and see if this trips up anyone else I guess.

simonmichael avatar Jul 09 '22 03:07 simonmichael

Well, currently --transpose is not ignored; it does what it says on the tin. Closing.

simonmichael avatar Jul 14 '23 07:07 simonmichael