;doc: csv: amount decimal places: expand, note import behaviour

This commit is contained in:
Simon Michael 2024-04-24 13:38:06 -10:00
parent 6fa69ab6e2
commit 69c0df4390

View File

@ -3834,13 +3834,19 @@ that would trigger the prepending effect, which we don't want here.
### Amount decimal places
Like amounts in a journal file,
the amounts generated by CSV rules like `amount1` influence
[commodity display styles](#commodity-display-styles), such as
the number of decimal places displayed in reports.
When you are reading CSV data, eg with a command like `hledger -f foo.csv print`,
hledger will infer each commodity's decimal precision (and other [commodity display styles](#commodity-display-styles))
from the amounts - much as when reading a journal file without `commodity` directives (see the link).
But note these commodity styles are not inferred from the numbers in the original CSV data;
rather, they are inferred from the journal entries generated by the CSV rules.
The original amounts as written in the CSV file do not affect display
style (because we don't yet reliably know their commodity).
When you are importing CSV data with the `import` command, eg `hledger import foo.csv`,
it's a little different: `import` [applies](#commodity-display-styles) the journal's existing commodity styles to the new entries.
So for each commodity, let's say for EUR, `import` will use:
1. the style declared for EUR by a [`commodity` directive](#commodity-directive) in the journal
2. or if there's no such directive: the style inferred from EUR amounts in the journal
3. or if there are no EUR amounts in the journal: the style inferred from EUR amounts generated by the CSV rules.
### Referencing other fields