;doc: csv: try to clarify how CSV/hledger fields work: tweak

This commit is contained in:
Simon Michael 2023-01-19 07:09:29 -10:00
parent b97b48926c
commit 3c22259047

View File

@ -3069,29 +3069,27 @@ becomes `1` when interpolated)
Note the two kinds of field names mentioned here, and used only in hledger CSV rules files: Note the two kinds of field names mentioned here, and used only in hledger CSV rules files:
1. **CSV field names** (`CSVFIELD` in these docs): 1. **CSV field names** (`CSVFIELD` in these docs):
you can optionally name the CSV columns for easy reference, you can optionally name the CSV columns for easy reference
by writing arbitrary names in a `fields` list (since hledger doesn't yet automatically recognise column headings in a CSV file),
(since hledger doesn't yet automatically recognise column headings in a CSV file). by writing arbitrary names in a `fields` list:
Eg:
```csv ```csv
fields Transaction_Date, Transaction_Id, Net_Amount, Total_Amount fields Transaction_Date, Transaction_Id, Net_Amount, Total_Amount, Other_Field
``` ```
2. Special **hledger field names** (`HLEDGERFIELD` in these docs): 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, you must set at least some of these to generate the hledger transaction from a CSV record,
by writing them in a [`fields` list](#fields-list) or 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 ```csv
date %Transaction_Date date %Transaction_Date
code %Transaction_Id code %Transaction_Id
amount1 $ %Total_Amount amount1 $ %Total_Amount
``` ```
or (equivalently): or directly in a [`fields` list](#fields-list):
```csv ```csv
fields date, code, , amount1 fields date, code, , amount,
currency $ currency $
``` ```
Here are all the special hledger field names available, and what happens when you assign values to them: Here are all the special hledger field names available, and what happens when you assign values to them:
### date field ### date field