doc: journal: rewrite balance assertions doc a little

This commit is contained in:
Simon Michael 2018-12-02 16:22:28 -08:00
parent 2d51cef88e
commit 552783a06b

View File

@ -392,19 +392,17 @@ instead.
The asserted balance must be a simple single-commodity amount, and in The asserted balance must be a simple single-commodity amount, and in
fact the assertion checks only this commodity's balance within the fact the assertion checks only this commodity's balance within the
(possibly multi-commodity) account balance. We could call this a (possibly multi-commodity) account balance.
partial balance assertion. This is compatible with Ledger, and makes This is how assertions work in Ledger also.
it possible to make assertions about accounts containing multiple We could call this a "partial" balance assertion.
commodities.
To assert the balance of more than a single commodity, you can add To assert the balance of more than one commodity in an account,
multiple postings (with amount 0 if necessary). you can write multiple postings, each asserting one commodity's balance.
To instead assert a commodity's balance to the exclusion of all others You can make a stronger kind of balance assertion, by writing a
in an account, use the exact assertion form `==EXPECTEDBALANCE` (note double equals sign (`==EXPECTEDBALANCE`).
the doubled equals sign). This, unlike multiple partial assertions, This "complete" balance assertion asserts the absence of other commodities
ensures that the account contains no unexpected commodities -- or (or, that their balance is 0, which to hledger is equivalent.)
equivalently, that the balance of any other commodity is 0.
``` {.journal} ``` {.journal}
2013/1/1 2013/1/1
@ -423,10 +421,8 @@ equivalently, that the balance of any other commodity is 0.
a 0 == $1 a 0 == $1
``` ```
Unfortunately, as of now, there is no way to specify that an account It's not yet possible to make a complete assertion about a balance that has multiple commodities.
contains exactly values of multiple commodities. Until and unless that One workaround is to isolate each commodity into its own subaccount:
capability is added, the best workaround is to isolate each commodity
into individual subaccounts:
``` {.journal} ``` {.journal}
2013/1/1 2013/1/1