Using Custom Tables

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Using Custom Tables Fri Nov 20, 2020 5:41 pm • by ctboeheim
I've just upgraded to version 5, and the Custom Tables look like they will simplify my rules tremendously.
However, when I try to set up a CSV file as an external table, it complains that the separator I've chosen does not result in a valid table. The drop down has only newline and tab, and I have also tried entering a comma in that field.

My table looks like this: (look for term, folder to put it in, and string for composing the filename)

Search,Folder,Name
Podiatry,Medical,Podiatry
Urology,Medical,Urology
Family Medicine,Medical,Family Medicine
Palo Alto Medical,Medical,PAMF
Sequoia Hospital,Medical,Sequoia

Image

Can you help me to get this to work?
-Chuck
ctboeheim
 
Posts: 5
Joined: Sat Jun 09, 2018 10:17 am

Re: Using Custom Tables Fri Nov 20, 2020 7:00 pm • by Mr_Noodle
By chance, was the csv generated on Windows, or by a Microsoft program? Could you email the file in to support?
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Using Custom Tables Fri Nov 20, 2020 9:12 pm • by ctboeheim
Mr_Noodle wrote:By chance, was the csv generated on Windows, or by a Microsoft program? Could you email the file in to support?


I created it by export from Numbers, but your mention of Windows prompted me to look at the file with `od -xc`. It has \r\n line ends. So I converted the line ends to Mac standard \n and it works now. Thanks for the hint!

It might be nice if it was forgiving about the line ends in some future release. I'll bet other people encounter this.
-Chuck
ctboeheim
 
Posts: 5
Joined: Sat Jun 09, 2018 10:17 am

Re: Using Custom Tables Sat Nov 21, 2020 2:11 pm • by ctboeheim
Is there a way to store a path name in a table to use with the 'sort into folders' action? My use case is data-driven sorting, where I have a CSV of invoice identifiers and places to store them, so I don't have to have a rule per destination. Something like this:

Lookup,Destination
Acct 1234,Banks/Bank 1/Checking
Acct 2345,Banks/Bank 2/Visa
Indemnity Corp,Insurance/IDP
Dr. H Kitty,Veterinarians

The path is varying length, so I don't think I can just put them in different columns and build the path in the action.

I've tried putting the unix path character / and the Mac path character : in the field, but they get taken literally.

So, is there any way to do this?
-Chuck
ctboeheim
 
Posts: 5
Joined: Sat Jun 09, 2018 10:17 am

Re: Using Custom Tables Mon Nov 23, 2020 1:04 pm • by Mr_Noodle
You can't do that now. Any path characters will be escape/translated. You might need different rules to handle the different path lengths.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Using Custom Tables Fri Nov 27, 2020 12:22 pm • by Mr_Noodle
I've been thinking about this more and I'm considering in a future release adding an option to tokens in a Sort into subfolder action where you can have Hazel interpret it as a path fragment. You can specify what character to use as the separator with presets for common ones (like : for Mac, / for UNIX and \ for Windows). Can't say when this will happen but it will handle your case as well as other more general ones (i.e. not table specific).
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Using Custom Tables Mon Nov 30, 2020 12:52 am • by jfisher
ctboeheim wrote:
Mr_Noodle wrote:By chance, was the csv generated on Windows, or by a Microsoft program? Could you email the file in to support?


I created it by export from Numbers, but your mention of Windows prompted me to look at the file with `od -xc`. It has \r\n line ends. So I converted the line ends to Mac standard \n and it works now. Thanks for the hint!
-Chuck


ctboeheim I am having this issue to. Can you explain how you did this?
jfisher
 
Posts: 55
Joined: Sat Feb 25, 2017 7:47 pm

Re: Using Custom Tables Wed Dec 16, 2020 10:28 pm • by ctboeheim
jfisher wrote:
ctboeheim wrote:
Mr_Noodle wrote:By chance, was the csv generated on Windows, or by a Microsoft program? Could you email the file in to support?


I created it by export from Numbers, but your mention of Windows prompted me to look at the file with `od -xc`. It has \r\n line ends. So I converted the line ends to Mac standard \n and it works now. Thanks for the hint!
-Chuck


ctboeheim I am having this issue to. Can you explain how you did this?


Sorry, I didn't see this until now. If you are comfortable using a command line to do it, this command does the trick:

perl -i -pe 's/\R/\012/' bad.csv

Many editors also have line end changing modes. Sublime Text, which is free for light use, can do this with the View->Linends menu command. Just change from Windows to Mac linends. Since there are vast numbers of editors, I don't have instructions for all of them, but google 'change line end characters with <my favorite editor>' and you may come up with some hints.

-Chuck
-Chuck
ctboeheim
 
Posts: 5
Joined: Sat Jun 09, 2018 10:17 am


Return to Support