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

This commit is contained in:
Simon Michael 2023-01-19 05:48:47 -10:00
parent b15d8d214d
commit bcf6a01c13

View File

@ -3069,17 +3069,19 @@ becomes `1` when interpolated)
Note the two kinds of "field names" used in hledger CSV rules: Note the two kinds of "field names" used in hledger CSV rules:
1. **CSV field names** (`CSVFIELD` in examples):\ 1. **CSV field names** (`CSVFIELD` in examples):\
These are arbitrary names you have given to columns in the CSV data, These are arbitrary names you have given to columns in the CSV data, by writing them in a `fields` list.
using a `fields` list, so that you can reference that CSV field This does not affect hledger's output (at least not directly); it only gives that CSV field a custom name,
more conveniently by name (`%SomeField`) rather than column number (`%13`). so that elsewhere, in a hledger field assignment, you can interpolate it by name (`%SomeField`) rather than column number (`%13`).
2. **hledger field names** (`HLEDGERFIELD` in examples):\ 2. **hledger field names** (`HLEDGERFIELD` in examples):\
These are special reserved names corresponding (directly or indirectly) to These are special reserved names corresponding (directly or indirectly) to parts of a hledger transaction.
parts of a hledger transaction (described here and in Journal > [Transactions](#transactions)). If you use one of these names in a [`fields` list](#fields-list), or in a [field assignment](#field-assignment) rule,
You assign values to these to construct a transaction (journal entry), it sets the value of some part of the hledger transaction corresponding the current CSV record, influencing the generated journal entry and hledger's output.
using field assignment rules or by writing them in a `fields` list.
Here are the hledger field names available in CSV rules, and their effects: Note these field names (both kinds) are used only in CSV rules files,
though the hledger field names correspond to the hledger transaction parts described in Journal > [Transactions](#transactions).
Here are the hledger field names available, and what happens when you assign values to them using a fields list or field assignment rule:
### date field ### date field