From 69c0df43907151ef45782780dd005b63159ba797 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 24 Apr 2024 13:38:06 -1000 Subject: [PATCH] ;doc: csv: amount decimal places: expand, note import behaviour --- hledger/hledger.m4.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index ed9b6fde3..7985c0991 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -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