Page 1 of 1

Custom Table to Combine Multiple Rules?

PostPosted: Sun Nov 22, 2020 1:46 pm
by hawks28
Hello, is there a way to use Hazel 5 to consolidate multiple rules for renaming statements into one rule with a custom table? I'm thinking of something like this.

Company..................Account......Date Format.....Rename
American Express.....11111........mm/dd/yy......amex - john_date.extension
American Express.....22222........mm/dd/yy......amex - mary_date.extension
Discover.....................33333.........mm/dd/yyyy...discover_date.extension
Mastercard................44444........m/d/yyyy.......mastercard_date.extension

I would like to use the company, account, and date format columns to then rename the file using the rename column and the recognized date (excuse the formatting as I wasn't sure how to create columns in my question).

This is easy to do as individual rules, but I was wondering if there was a way to do this with the new custom tables functionality. I think searching for Company and Account works fine, but the date aspect is where this probably falls apart (and perhaps there's something I'm missing about how the custom table functionality works).

Thanks!

Re: Custom Table to Combine Multiple Rules?

PostPosted: Sun Nov 22, 2020 8:22 pm
by ctboeheim
Ive been thinking about this also, and the best I've been able to come up with so far is have the table

Match,Rename
Company 1,{DF1} Company name.ext
Company 2,{DF2} Company name 2.ext

The first rule would be

if Content contains (table match column 1)
rename {table column2).ext
continue matching

Then some rules

if name matches "{DF1}"<anything> (and assign anything to a variable named postmatch)
and contents contain custom date('yyyy-mm-dd") (assign to variable stmt_date
rename (stmt_date)(postmatch).ext
continue matching

if name matches "{DF2}"<anything> (and assign anything to a variable named postmatch)
and contents contain custom date('mm/dd/yy") (assign to variable stmt_date
rename (stmt_date)(postmatch).ext
continue matching

So far I've need a fairly small number of {DFn} rules to handle the different date formats.

That's as far as I got before Hazel ate my rules and gave me a "Corrupted rules" message.
-Chuck

Re: Custom Table to Combine Multiple Rules?

PostPosted: Mon Nov 23, 2020 1:14 pm
by Mr_Noodle
If you got a corrupted rules message, can you please email support with details? If you could grab the rules under the Application Support folder and send those, that would help.