--You received this message because you are subscribed to the Google Groups "hledger" group.To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.To view this discussion visit https://groups.google.com/d/msgid/hledger/f1a7c99e-ffca-4c8c-87c3-ee66724c6180n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "hledger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hledger/y9RiUixwD5Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hledger+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hledger/86a5d4ab-96ef-4d6f-b2dd-901270454dde%40app.fastmail.com.
To view this discussion visit https://groups.google.com/d/msgid/hledger/CAA85kdVSnQ4iF9V5OJMH-H58uS567VVQjD1KE0Lb8yVk0cTRsA%40mail.gmail.com.
hledger bse -V
also works (valuing all on the same date). I think that's the only way to balance the accounting equation, since otherwise there's price skew as you say.--You received this message because you are subscribed to the Google Groups "hledger" group.To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hledger/CAA85kdW5qtH4CpxDExw5TL2_XMC_2WxObh9h1jpZAp9iP1jcaQ%40mail.gmail.com.
Long story short: the "close to native currency case works for me" - if one file includes the other as a subfile (it doesn't matter which way round).Then,hledger bse -V
also works (valuing all on the same date). I think that's the only way to balance the accounting equation, since otherwise there's price skew as you say.Why ? Balance assertions can span a hierarchy of files, but not sibling files.Why ? I think it's by design/necessity, to keep reports stable. I have just now expanded the relevant section in the docs: https://hledger.org/dev/hledger.html#assertions-and-multiple-filesLet me know what you think.
This was a very nice repro (which I needed, to get traction). Sorry this one "feature" cost you so much time ...
[...]
The attached example works for me: main.ledger includes sub1.ledger and
sub2.ledger "side-by-side". All of them include asserts that succeed.
I ran 'hledger -f main.ledger check -s'.
> To work around this, arrange your files in parent child relationships
> with include. Eg make one subfile include the other (it doesn't matter
> which way round).
And so, I have doubts if this is needed. Moreover, I hope it is not
needed, because a typical use of combining multiple files has some
side-by-side inclusions (and making this a deep tree of sub-includes is
awkward).
On Sat, Apr 26, 2025 at 8:58 AM Marco van Hulten <ma...@hulten.org> wrote:[...]The attached example works for me: main.ledger includes sub1.ledger andsub2.ledger "side-by-side". All of them include asserts that succeed.I ran 'hledger -f main.ledger check -s'.This is exactly what I did and that worked for me:--- begin file main.FX.journal ---include before_closing.journalinclude close_retained_earnings.FX.journal--- end ---> To work around this, arrange your files in parent child relationships> with include. Eg make one subfile include the other (it doesn't matter> which way round).And so, I have doubts if this is needed. Moreover, I hope it is notneeded, because a typical use of combining multiple files has someside-by-side inclusions (and making this a deep tree of sub-includes isawkward).It seems that it suffices to specify exactly only one file in the hledger command with `--file`.
It seems that it suffices to specify exactly only one file in the hledger command with `--file`.I have corrected the doc at https://hledger.org/dev/hledger.html#assertions-and-multiple-filesand pushed these tests demonstrating the current behaviour:
(And this makes sense, because `include` is equivalent to inlining the file (recursively). So any include hierarchy is equivalent to one big flattened file.)The new questions are:Should we change hledger so that the order of -f options on the command line is significant for balance assertions ?How hard is that to implement ?What things other than balance assertions should also become sensitive to -f order, for consistency ?What command line options/arguments other than -f should also become order sensitive, for consistency ?What would be the impact on existing users/data and the transition strategy ?
It seems that it suffices to specify exactly only one file in the hledger command with `--file`.I have corrected the doc at https://hledger.org/dev/hledger.html#assertions-and-multiple-filesand pushed these tests demonstrating the current behaviour:(And this makes sense, because `include` is equivalent to inlining the file (recursively). So any include hierarchy is equivalent to one big flattened file.)The new questions are:Should we change hledger so that the order of -f options on the command line is significant for balance assertions ?
Aha! I guess I was wrong. I assumed that hledger guaranteed that it would process the files in the order in which I provide them to the command by the `--file` switch. Do I have that wrong?
> PS another consequence of making assertions see balances from a previous -f file: the second file becomes effectively dependent on the first file - it's no longer self contained. So if you want to use FILE2 you must write -f FILE1 -f FILE2 every time.In practice, this doesn't bother me yet. In my example, the "close to retained earnings for year n" file is optional in the sense that the accountants want it, but I don't care for basic financial information. I don't care about Retained Earnings, since it doesn't really affect my business decisions (yet) and I would prefer to have the option to compare revenue and expenses from multiple years. This leads me to treat the `close_retained_earnings.YEAR.journal` files as optional and clearly (by their intention) dependent on the journal files from the year(s) prior. I would fully expect a journal file with that name only ever to make sense in the larger context of yearly journal files.In theory, this might bother me, but I can't quite imagine the scenario yet. I suppose I would rely on naming files to ensure that I knew whether a journal file depends on other files or not. And if that dependency were unclear, I'd make that dependency clearer by using `include` in a container journal file.I'm curious what others might think about that.--J. B. (Joe) Rainsberger :: tdd.training :: jbrains.ca ::Replies from this account routinely take a few days, which allows me to reply thoughtfully. I reply more quickly to messages that clearly require answers urgently. If you need something from me and are on a deadline, then let me know how soon you need a reply so that I can better help you to get what you need. Thank you for your consideration.
--You received this message because you are subscribed to the Google Groups "hledger" group.To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/hledger/CAA85kdUZEL7nZxbhG3i6FaiN0tjFVvbGFLqYYwsJCFZp%2BCxyTw%40mail.gmail.com.
Aha! I guess I was wrong. I assumed that hledger guaranteed that it would process the files in the order in which I provide them to the command by the `--file` switch. Do I have that wrong?
New question: Does the documentation scream bloody murder about no guarantee of the processing sequence of files provided with `--file`? If it doesn't, then I believe it should. And if it does, then how the hell did I miss that?!
Since the last thread drifted to discussions of the `--file` switch, I'm continuing here with the discussion about converting balances to a base currency.Yes, it seems like this is what I want to do. Now, the question becomes how to do it?I have played around a little until something seemed to work, but what I have looks entirely and horrifyingly wrong. I'm hoping to learn from your suggestion without anchoring you to mine. :)If you'd like, please use my minimal example. What posting do I need to convert the balance of Revenue to 0 CAD at the same time as posting retained earnings?
The file order is definitely significant for some things. More generally, we can speak of parse order. It works like this:- Dated things (transactions, postings, balance assertions, balance assignments, P..) are not affected by parse order. Except, when multiple things have the same date, those will be processed in parse order.- Undated directives which are position sensitive (alias, comment..) are processed in parse order.- Undated directives which apply globally (account, commodity, payee..) are not affected by parse order.I did a quick check for mentions of order or position sensitivity in the manual, related to CLI args or journal format:But I guess the above general principle does not appear in the manual, perhaps it should. Or the FAQ ? It's hard to deliver the right information to the person who needs it when they need it, without overwhelming the poor user who wants other information.
It’s useful to think about journals vs files.A journal can consist of multiple included files. A journal is checked for errors as a unit, as if it was one big file.You can read multiple journals at once by providing multiple -f options; but each of those is checked separately. So eg balance assertions don’t span journals.Design issues...setup -> create a starter journal -> what file layout ? -> directive scope -> ...I notice that account, commodity, payee, tag directives are global in scope - no matter where they are seen, they are used to check all files in all journals (including multiple -f's)This is usually convenient, but it also goes against the goal of having journals be standalone and not affected by transient things like the presence/absence of other journals on the command line.It also means that if accounts change from year to year, you can't accurately check accounts in multiple year journals/files at once, even if you write the declarations down in the year files - all declarations in any file will affect all files. The only way you can be sure a year is using only the correct account names for that year is to check that file in isolation.If alias directives and balance assertions are journal-local, why aren’t these other directives ? Seems inconsistent