E-Junkie Forum http://www.e-junkie.com/bb/ E-Junkie Forum RSS en-us Copyright 2013, 19.5 Degrees. All rights reserved. webmaster@e-junkie.com webmaster@e-junkie.com Thu, 18 Aug 2011 18:11:09 GMT Thu, 23 May 2013 08:14:24 GMT 681 E-JUNKIE 5 E-Junkie Forum http://www.e-junkie.com/bb/ http://www.e-junkie.com/ej/logo.gif 290 104 Post #2 http://www.e-junkie.com/bb/topic/5390/pg/0#post18606 http://www.e-junkie.com/bb/topic/5390/pg/0#post18606 Thu, 18 Aug 2011 18:11:09 GMT 5) Type "chmod +x find_customers.rb"]]> E-junkie Discussions; twisted Post #1 http://www.e-junkie.com/bb/topic/5390/pg/0#post18606 http://www.e-junkie.com/bb/topic/5390/pg/0#post18606 Tue, 16 Aug 2011 22:23:16 GMT http://mattmower.com/) and if you need similar work done, give him a shout, but please DO NOT trouble him with tech support questions for this script. He is super quick and pleasant to work with. I assume no responsibility for this script and by downloading it you acknowledge that.

The script finds customers in an ejunkie.csv file(s) and organizes them based on which products they own (based on the emails used to purchase). For example, need to know who owns at least 3 products? Need to know exactly who owns a specific combination of products? This script does it and generates a csv file with the required info.

http://superpositionstudios.com/find_customers.zip

Put the ejunkie csv file(s) to search in the folder called 'Data'. They need to be .csv (not .txt files) and make sure you haven't altered the number of columns.

Before you can run it you need to do the following steps (this is the best I can remember, I may be missing a step):

*Remove "" when typing into terminal.

1) Open terminal
2) Type "gem install trollop" (you may need to do "sudo gemo install trollop" if you get permissions errors)
3) Type "gem install fastercsv" (you may need to do "sudo gem install fastercsv" if you get permissions errors)

You shouldn't need to do these again.

4) Type "cd ~/Desktop/ NAME OF FOLDER WHERE SCRIPT IS
5) Type "chmod +x process.rb"
5) Type "./find_customers.rb" (and see below for details)

Now we get to running find_customers.rb.

This script has 3 options with defaults. You can always type

./find_customers.rb --help

if you want to see them explained.

-e : switches from the default "at least" to "exactly" mode
-n <number> : specifies the number of products required in either mode, e.g. -n 4
-f <filename> : uses the given filename as the output file instead of "qualifying_customers.csv"

If you don't specify -n it will default to the number of products listed in the "products.yml" file.

So:

./find_customers.rb -e -n 2 -f two_products.csv

Will generate a file "two_products.csv" containing all your customers who have exactly 2 of the qualifying products.

While:

./find_customers.rb -n 4 -f at_least_four.csv

Will generate a file "at_least_four.csv" containing all of your customers who have at least 4 of the qualifying products. And:

./find_customers.rb

Will generate a file "qualifying_customers.csv" that contains all customers who have all of your products

and so on.

To add products you don't edit the script but the "products.yml" file (using text application). To add a new product just copy the last line and change the name to your new product name as per the current entries.]]>
E-junkie Discussions; twisted