From 717e86ff28668ca127104bef96680bbc834ea23b Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 21 Oct 2024 12:38:21 -1000 Subject: [PATCH] ;examples:csv: a YNAB 4 example, with workaround for RTL currency symbol --- examples/csv/ynab4-rtl.csv | 3 +++ examples/csv/ynab4-rtl.csv.rules | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 examples/csv/ynab4-rtl.csv create mode 100644 examples/csv/ynab4-rtl.csv.rules diff --git a/examples/csv/ynab4-rtl.csv b/examples/csv/ynab4-rtl.csv new file mode 100644 index 000000000..24269fe27 --- /dev/null +++ b/examples/csv/ynab4-rtl.csv @@ -0,0 +1,3 @@ +"Account","Flag","Check Number","Date","Payee","Category","Master Category","Sub Category","Memo","Outflow","Inflow","Cleared","Running Balance" +"checking1",,,2022/11/07,"shop1",,,,"Lunch",د.ا.‏4.750,د.ا.‏0.000,C,د.ا.‏0.000 +"creditcard1",,,2022/12/11,"coffeeshop",,,,"Coffee",د.ا.‏93.210,د.ا.‏0.000,C,د.ا.‏56.790 diff --git a/examples/csv/ynab4-rtl.csv.rules b/examples/csv/ynab4-rtl.csv.rules new file mode 100644 index 000000000..f1129a955 --- /dev/null +++ b/examples/csv/ynab4-rtl.csv.rules @@ -0,0 +1,28 @@ +skip 1 +fields account, flag, check_number, date, payee, category, master_category, sub_category, memo, outflow, inflow, cleared, running_balance +if %cleared C + status * + +description %payee | %memo +account1 %account +#account2 %category + +# the RTL currency symbol breaks these somehow +#amount-out %outflow +#amount-in %inflow +#balance1 %running_balance +#currency د.ا.‏ + +# so extract the amounts with regex groups + +if %inflow ([0-9]+\.[0-9]+) + amount-in \1 + +if %outflow ([0-9]+\.[0-9]+) + amount-out \1 + +if %running_balance ([0-9]+\.[0-9]+) + balance1 \1 + +# and use the ISO-4217 code instead +currency JOD