[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/csv2ledger 170dc4ae5c 102/190: Update README.md
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/csv2ledger 170dc4ae5c 102/190: Update README.md |
Date: |
Sun, 2 Jun 2024 15:59:49 -0400 (EDT) |
branch: elpa/csv2ledger
commit 170dc4ae5c2232eddedcf9a222c303490049d6d9
Author: Joost Kremers <joostkremers@fastmail.fm>
Commit: Joost Kremers <joostkremers@fastmail.fm>
Update README.md
---
README.md | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 607d68996d..ac971e97a1 100644
--- a/README.md
+++ b/README.md
@@ -97,6 +97,8 @@ Two things are of note here: first, the order of this list
determines the order
If you wish or need to modify the values extracted from the CSV file in some
way, there are several user options that allow you to do so.
+### Modifying individual fields ###
+
First, there is the option `c2l-field-modify-functions`. This is an alist
mapping field names to functions. Each function should take a string as its
only argument and return a string. These functions are called with the field's
value as argument and the return value is used to construct the entry.
As an example, my CSV files provide the date in the format `DD.MM.YYYY`, but
ledger expects them to be in the format `YYYY-MM-DD`. To remedy this,
`csv2ledger` comes with the function
`c2l-convert-little-endian-to-iso8601-date` that takes a date in the format
`DD.MM.YYYY` and converts it to `YYYY-MM-DD`. For convenience, it also accepts
dates in the forms `DD-MM-YYYY` and `DD/MM/YYYY`.
@@ -132,6 +134,8 @@ The setting for `c2l-field-parse-functions` then ends up
like this:
(amount . c2l-convert-postbank-to-ledger-amount)))
```
+### Modifying the transaction ###
+
One potential disadvantage of the functions in `c2l-field-modify-functions` is
that they only take the value of a single field as argument. This is
insufficient if you want to modify a field value on the basis of the other
fields in the transaction. If you need to make such a change to the
transaction, you can set the option `c2l-transaction-modify-function` to a
function that takes the entire transaction as its argument and returns a
modified transaction.
The transaction will be passed as an alist of field-value pairs. For example,
for the ledger entry shown above, the transaction would be something like this:
@@ -149,7 +153,17 @@ Your function can make any change to the transaction you
wish. The only requirem
Note that in this transaction alist, the values for date and amount have not
been modified by the functions if `c2l-field-modify-functions`. This is because
`c2l-transaction-modify-function` is called first. The result of that function
is passed to the functions in `c2l-field-modify-functions`. In principle,
`c2l-transaction-modify-function` can do anything `c2l-field-modify-functions`
can do, but the latter type of function is conceptually simpler, which is why
it's included here.
-You may also notice that the transaction alist does not contain a value for
`title`. The `title` field is added to the transaction alist after the
functions in `c2l-field-modify-functions` have been applied.
+
+### Setting the title ###
+
+You may also notice that the transaction alist does not contain a value for
`title`. The `title` field is added to the transaction alist after the
functions in `c2l-field-modify-functions` have been applied. The function that
creates the title is configurable through the option `c2l-title-function.` Its
default value is `c2l-payee-or-sender`, which returns the sender if the payee
matches the value of `c2l-account-holder` and the payee otherwise. It makes
sure to check that it does not re [...]
+
+`c2l-title-function` should be set to a function that takes a transaction as
an alist and returns the title of the transaction as a string. This means that
if you want to use something other than the payee or the sender as the title,
e.g., the description field, you can. Just write a short function that extracts
the relevant value from the transaction and returns it.
+
+
+### Setting the amount ###
+
+As already mentioned above, a CSV file may contain the amount of a transaction
in a single column, or it may use separate columns for amounts debit and
amounts credit.
TODO
- [nongnu] elpa/csv2ledger 8e01e8379b 026/190: Update doc string of `c2l-base-account`., (continued)
- [nongnu] elpa/csv2ledger 8e01e8379b 026/190: Update doc string of `c2l-base-account`., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 3ed3afc06b 025/190: Update doc string of `c2l-csv-entry-as-kill`., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 6e9838193e 023/190: New function: `c2l-payee-or-sender`., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 2cf9b08114 020/190: Remove function `c2l-parse-amount`., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger d8ee57f181 006/190: Update copyright year., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger c1fb4a3255 013/190: Reconcile commits 6023fa3 and 1e4bd7c., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 7635ee6fe3 007/190: Update "Created" year in header., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger b4f6fac379 002/190: Add .gitignore, ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 6023fa373b 012/190: Use lower-case column names in `c2l-csv-columns`., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger a4ded4f5dc 109/190: Change the default value of c2l-csv-columns to the empty list., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 170dc4ae5c 102/190: Update README.md,
ELPA Syncer <=
- [nongnu] elpa/csv2ledger 07281e2558 097/190: Update to the README., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger f234878bd2 180/190: Update to the README, ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 3b203a66e1 118/190: Improve code layout., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 64da760597 119/190: Update copyright year., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 98ab50c9a7 185/190: New command c2l-read-account-matchers, ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger e744d0706f 186/190: Update version number., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 188ddacde7 057/190: Rename target account to balancing account., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger a1b0dd35e1 053/190: Update README., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 88c394d5bb 066/190: Rename c2l-payee-or-sender to c2l-title-is-payee-or-sender., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger e8a7609736 050/190: Add user option `c2l-alignment-column`., ELPA Syncer, 2024/06/03