;csv: doc: amount tips: tweaks

This commit is contained in:
Simon Michael 2021-01-07 10:15:13 -08:00
parent c21b666130
commit eafdae3886

View File

@ -3936,7 +3936,7 @@ Here are the ways to set a posting's amount:
guessing an appropriate sign. guessing an appropriate sign.
- **If hledger guesses the wrong sign:**\ - **If hledger guesses the wrong sign:**\
You can prepend a minus sign to flip it. Eg: Prepend a minus sign to flip it. Eg:
```rules ```rules
fields date, description, amount-in, amount-out fields date, description, amount-in, amount-out
@ -3950,11 +3950,11 @@ Here are the ways to set a posting's amount:
```csv ```csv
"", "" "", ""
"0", "0" "0", "0"
"1", "1" "1", "none"
``` ```
If you have CSV like this, use [conditional rules](#if-block) instead of `amountN-in`/`amountN-out`. If you have CSV like this, use [conditional rules](#if-block) instead.
For example, if you want hledger to use the value containing non-zero digits: For example, if you want hledger to choose the value containing non-zero digits:
```rules ```rules
fields date, description, in, out fields date, description, in, out
@ -3969,21 +3969,23 @@ Here are the ways to set a posting's amount:
This sets posting 1's and posting 2's amounts (and converts posting 2's amount to cost). This sets posting 1's and posting 2's amounts (and converts posting 2's amount to cost).
This is supported for backwards compatibility (and occasional convenience). This is supported for backwards compatibility (and occasional convenience).
4. **If the CSV has the balance instead of the posted amount:**\ 4. **If the CSV has the balance instead of the transaction amount:**\
Assign to `balanceN`, which sets posting N's amount indirectly via a Assign to `balanceN`, which sets posting N's amount indirectly via a
[balance assignment](hledger.html#balance-assignments). [balance assignment](hledger.html#balance-assignments).
(Old syntax: `balance`, equivalent to `balance1`.) (Old syntax: `balance`, equivalent to `balance1`.)
- **If hledger guesses the wrong default account name:**\ - **If hledger guesses the wrong default account name:**\
When setting the amount via balance assertion, hledger may guess the wrong default account name. When setting the amount via balance assertion, hledger may guess the wrong default account name.
So, set the account name explicitly. Eg: So, set the account name explicitly, eg:
```rules ```rules
fields date, description, balance1 fields date, description, balance1
account1 assets:checking account1 assets:checking
``` ```
There is some special handling for an amount's sign, to simplify parsing and sign-flipping: ### Amount signs
There is some special handling for amount signs, to simplify parsing and sign-flipping:
- **If an amount value begins with a plus sign:**\ - **If an amount value begins with a plus sign:**\
that will be removed: `+AMT` becomes `AMT` that will be removed: `+AMT` becomes `AMT`