milodaman Posted February 12, 2016 Share Posted February 12, 2016 Hi Guys, I was hoping to find an existing workflow where I could type in a key phrase and it would return an associated value. For example, I could type in a customer_name and it would return the customer_id. Extra points if it could search for partial matches. Currently the values are in a SQL DB, but I could dump them into a google sheet or something. Any places you guys recommend to start my search? Thx! -Mark Link to comment
deanishe Posted February 12, 2016 Share Posted February 12, 2016 (edited) Here is a demo workflow I wrote for someone that does exactly this, but based on an Excel spreadsheet. The code is extensively commented to explain what's going on. It's be easy enough to swap out the Excel bit for a database, but you didn't say what kind of database you're using. A Google sheet would be a terrible idea, as they're online only. It would make the workflow a lot slower and a lot more complicated to implement (you'd need to work with the Google APIs). It uses Alfred-Workflow's search algorithm, so you get partial matching, substring matching, initial letter matching etc. out of the box. Edited February 12, 2016 by deanishe Link to comment
milodaman Posted February 12, 2016 Author Share Posted February 12, 2016 Wooho! Thanks deanishe! Got it installed and working. However, I have to ask a total knob question. I've updated the Data.xls file that it's referencing search.py with my data. Clearly I need to do something to get it to reload my data. Do I need to build the workflow? Is there a page somewhere that explains this? Sorry for being such a dummy :-( Mark Link to comment
milodaman Posted February 12, 2016 Author Share Posted February 12, 2016 And by the way, I'm pulling from a Google MySQL DB. -Mark Link to comment
milodaman Posted February 12, 2016 Author Share Posted February 12, 2016 Nevermind, figured out that I needed to change it in another directory, not the original directory. thx! Link to comment
deanishe Posted February 12, 2016 Share Posted February 12, 2016 You can keep the Excel file anywhere you want, you just need to change line 29 in the search.py script. (As you've figured out, that means search.py inside the installed workflow.) Link to comment
deanishe Posted February 12, 2016 Share Posted February 12, 2016 Regarding MySQL: If Google uses a standard MySQL installation, the workflow can be modified relatively easily to pull data directly from the database. You could query the database live (i.e. on every query) or periodically cache the dataset you're interested in. Alfred-Workflow makes the latter very simple to do. I recommend you read the Alfred-Workflow docs linked in my signature if you want to know more. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now