From eb793853887eba5496376b1dd43083002f7423f8 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 19 Jan 2023 07:17:24 -1000 Subject: [PATCH] ;doc: csv: try to clarify how CSV/hledger fields work: tweak --- hledger/hledger.m4.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index 937ec4b14..dded5edf0 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -3071,23 +3071,26 @@ Note the two kinds of field names mentioned here, and used only in hledger CSV r 1. **CSV field names** (`CSVFIELD` in these docs): you can optionally name the CSV columns for easy reference (since hledger doesn't yet automatically recognise column headings in a CSV file), - by writing arbitrary names in a `fields` list: + by writing arbitrary names in a `fields` list, eg: ```csv - fields Transaction_Date, Transaction_Id, Net_Amount, Total_Amount, Other_Field + fields When, What, Some_Id, Net_Amount, Total_Amount, Foo, Bar ``` 2. Special **hledger field names** (`HLEDGERFIELD` in these docs): you must set at least some of these to generate the hledger transaction from a CSV record, - by writing them as the left hand side of a [field assignment](#field-assignment): + by writing them as the left hand side of a [field assignment](#field-assignment), eg: ```csv - date %Transaction_Date - code %Transaction_Id - amount1 $ %Total_Amount + date %When + code %Some_Id + description %What + comment %Foo %Bar + amount1 $ %Total_Amount ``` or directly in a [`fields` list](#fields-list): ```csv - fields date, code, , amount, + fields date, description, code, , amount, Foo, Bar currency $ + comment %Foo %Bar ``` Here are all the special hledger field names available, and what happens when you assign values to them: