From 876f1158068e4f9726a7de1beeb9f1d690148279 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 24 Apr 2024 14:13:22 -1000 Subject: [PATCH] ;doc: csv: amount decimal places: edits --- hledger/hledger.m4.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index c71f5a58b..cfec475ae 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -3837,16 +3837,19 @@ that would trigger the prepending effect, which we don't want here. 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; + +Note these commodity styles are not inferred from the numbers in the original CSV data; rather, they are inferred from the amounts generated by the CSV rules. 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: +there's another step: `import` tries to make the new entries [conform](#commodity-display-styles) to the journal's existing styles. +So for each commodity - let's say it's EUR - `import` will choose: -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. +1. the style declared for EUR by [a `commodity` directive](#commodity-directive) in the journal +2. otherwise, the style inferred from EUR amounts in the journal +3. otherwise, the style inferred from EUR amounts generated by the CSV rules. + +TLDR: if `import` is not generating the precisions or styles you want, add a `commodity` directive specifying them. ### Referencing other fields