A rule can be composed of up to six test conditions, based on any of the available fields.
For text based data (Memo, Payee, Reference) you can use a starts with or contains. For example a test of Any field starts with “interest” will match a memo of “Interest paid”, but not “Bank Interest”. If the test was changed to contains it would match both.
Note: Text comparisons are not case sensitve, so “interest” will match with “INTEREST”.
For the amount, the test is numeric, so you can compare whether the amount is equal to, greater than, etc. some defined valued.
For the Bank/Contra test, you need to enter the general ledger account code of the bank. The test compares this to the target bank (either the bank account selected in Load Bank Statement, or, if invoking the rule during transaction entry, the bank currently selected in the Bank pop-up menu).
Note that, if the All of these tests option is selected, all the test conditions specified must be true for the rule to apply. If the Any of these tests option is selected, the the rule is applied if any one of the tests is true.
If you require more complex comparisons, then you select This expression and enter a MoneyWorks expression into the expression field. If the expression is evaluated to false (or zero), the rule will not apply; any other value will be treated as true.
The expression can reference the keywords Memo, Name, NameOrMemo, Ref, Amount and Contra, which correspond to the available fields on the bank statement. You would need to do this for example if you want to apply a rule only to transactions within a given amount range:
name=`Smith@` and amount > 100 and amount < 200
would match only if the name started with “Smith” and the amount was between $100 and $200.
For even more complex matching, you can call a public mwScript handler from here, as in:
myscripts:checkstmt(name, ref, amount)
It is (of course) your responsibility to make sure that the script returns a sensible value in a timely manner.