-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feedback] Rule action templating #3606
Comments
Some additional variables I would appreciate being added are:
|
I think these could best be added as helper functions. Especially the second one. |
This looks incredibly powerful, I will turn this on and start playing with it. My condolences to whoever eventually takes on the task of building a UI for this! 😃 |
I don't thing there will ever be an UI for this, (at most an helper to show which fields are available). As that it would most likely limit the usage of this function. |
I'd love to see some examples of using the date functions. As of now I have only successfully got a result with {{today}}. {{day today}} for example doesn't bring up any result. {{date}} doesn't work. What surprisingly worked was {{regex today "-[0-9]{2}-[0-9]{2}" "-11-01"}} to set the date. But right now making date calculations doesn't seem to be supported at all, is that assumption correct? I'd love to see that as a feature. Along with other date functions (first of month, end of month etc.) /E: To everyone interested, the following rule template will move the transaction to the first of the next month (including changing the year):
|
Not sure if I'm using this wrong but I'm trying to do a currency conversion by using the following rule to set the amount: I thought maybe it was down to decimal places so I also tried: Both result in the following error: If I look at the console, it shows: If I use the same rule but to set the note rather than the amount, then it works fine. |
@londondev77 the amount should be in cents (*100). Decimals are not allowed, |
Thanks. I misread the note about decimal places in the instructions at the top. Unfortunately I can't test for the rest of the day as I've used up my GoCardless rate today. |
@londondev77 You don't need to import transactions to test this. In the edit window of each rule you see a list of matching transactions. Just click the checkbox in the leftmost column and then click "Apply actions" in the top right above said list. |
Another useful value for the templating would be the balance of a budget category. For example in a split rule have a split line of amount = balance of and a second split line of amount = remainder. |
Could someone help me with following: I got a monthly payment for savings. This is categorised as payment, but I want to categorise it a deposit. So from - to +. How can I do this? Amount does change every month. |
@TWilhoWI |
Thank you very much! |
Wow this looks powerful! |
@nmathey For payments: For deposits: |
Yeah I just tried to apply whats @IsThisThingStillOn were referring too even if it looked weird for me as is. |
We could achieve this by adding regex matching to the amount field. I will look if I can get this working. |
My imported payees always start with "CARDXXXX" or "CARDXXXX DD/MM", would this new feature allow me to remove those automatically ? |
It could, but you probably should be able to use a regular "imported_payee"-"contains" rule and not need to use a template rule. |
@youngcw Ah nice !
I'm struggling to know how to extract the |
I don't think you need to extract anything. Use if imported payee contains "Grocery Store", set payee "Grocery Store" |
@youngcw Ah yes I already do that, but a universal rule on import would help a lot with readability when sorting through the transactions. Hopefully that's possible with rule action templating. Since the proposed solution includes regex replacement and imported payee, it's looking promising ! |
I think you should be able to do something like the below... it might need a bit of tweaking though if: imported payee contains "CARD" (regex is not availble for rule criteria) AND account = the account you're seeing this on |
Had to make a few tweaks (mine is in french so "Carte XXXXX" and the date field is optional). For those interested, the final formula is |
My only issue right now is, I can't choose the order. I'd like it to be above some of my set payee rules, but it's right in the middle for some reason. |
The UI is quite difficult, even as a software engineer who loves regex 😄 There is no feedback on the regex execution: is the regex valid ? what is going on if I apply the regex (a dry-run is missing) ? I'm doing exactly the same as many of you: extract payee and date from the imported_payee. Here is my solution for the pattern
Note The date is not following the display format but the ISO8601 format like Btw, it could be awesome to use the condition catched groups to to repeat the regex like:
And even better using group names to better understand the catched groups:
Quick proposal: change the date template placeholder from |
Rule action templating allows rules to dynamically set fields based on transaction data.
To enable the feature - head over to experimental features and toggle the rule action templating feature flag. Next, go to the "rules" page and set up a new rule.
To use it, click the icon on the right hand side of the input box to toggle from "text" to "template" mode:
Text mode:
Template mode:
Then enter your template. For example, the below will replace the notes field with the VAT paid (standard VAT is 20% in the uk)
At the moment, templating is supported for setting:
Full list of available helper functions:
regex value regex replacement
add num1 num2 ...
sub num1 num2 ...
div num1 num2 ...
mul num1 num2 ...
mod num1 num2 ...
floor num
ceil num
round num
abs num
min num1 num2 ...
max num1 num2 ...
fixed num1 num2
day date
month date
year date
format date format
debug value
(logs to console)Full list of available variables that can be used
today (date)
account (id)
amount (number)
15200
.{{div amount 100}}
can be used to convert backcleared (boolean)
date (date)
error (?)
imported_id (id)
imported_payee (string)
is_child (boolean)
is_parent (boolean)
notes (string)
parent_id (id)
payee (id)
reconciled (boolean)
schedule (id)
sort_order (number)
starting_balance_flag (boolean)
tombstone (boolean)
transfer_id (id)
Feel free to share your ideas, bug reports and feedback below.
The text was updated successfully, but these errors were encountered: