On 7/8/18 10:39 PM, o1bigtenor wrote:
On Sun, Jul 8, 2018 at 8:08 AM, Scott Carpenter <[email protected]>
wrote:
It may be helpful to create a sample file with a simple structure with
which you can experiment, for example:
expenses: fruit: apple: red: minnesota
expenses: fruit: apple: red: wisconsin
expenses: fruit: apple: yellow: fu
expenses: fruit: apple: yellow: bar
And then you can make some transactions where you can play with --depth to
see how you can summarize things.
The account structure with colons simple defines a a tree structure as
Craig said. Then, --depth lets you define how far down in the tree you want
to report on. If you specified --depth 4 with above, you'd get totals for
red and yellow apples for all states or fu or bar or whatever designation.
Thank you for your ideas!
I will admit that when I started running various commands in ledger using
$ ledger reg 9808 -f /some/file/location.dat
as a kind of base I was quite surprised to see that everything I wanted was
already available without me needing to change anything.
So I looked at:
1. $ ledger reg 9808 -f /some/file/location.dat
2. $ ledger reg 9808.10 -f /some/file/location.dat
3. $ ledger reg 9808.10.01 -f /some/file/location.dat
4. $ ledger reg 9808.10.01.02-f /some/file/location.dat
5. $ ledger reg 9808.10.01.03 -f /some/file/location.dat
Hi Dee,
the reason that just works for you is that ledger's arguments are
regular expressions, which select all account names containing a match.
So eg "9808" matches all account names containing that string, anywhere
in the name. It would also match "account198082". If that was causing
problems, you could match only at the start of the name by using "^9808".
Also the "." in "9808.10" matches any character, so that would match
"9808X10". To prevent that, you could use a backslash, so: "^9808\.10".
https://www.regular-expressions.info explains more about regular
expressions.
The --depth flag is (very) useful when you want less detail, hiding
subaccounts (while still including their totals). But it will only work
if you tell Ledger how the account names are subdivided, by using the
":" character. (And be aware that in Ledger it may work better with some
reports than others, eg don't combine it with balance --flat).
Best
-Simon
--
---
You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.