Export the e-mail addresses only...

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
sblasic
Veteran Member
Posts: 53
Joined: 2021-02-22 15:55

Export the e-mail addresses only...

Post by sblasic » 2021-09-09 08:30

Hi AG Community!

I have a simple clients database (over 1000 contacts) -and I want to "extract" (preferably in CSV format) only the e-mail addresses (email field) of certain specialties (i.e.: graphic designers, art directors...).

The reason for this is an upcoming email campaign and I want to be able to send the notifications only to the certain group of people...

Can something like this be achieved by "filtering"?

****

Additional info: The email campaign will be done through online "mass mailing" service which allows CSV imports.

Thank you in advance for your help/suggestions!

Best!

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: Export the e-mail addresses only...

Post by pfrumkin » 2021-09-09 15:13

Hi,

The filtering just puts conditions on the extract, to include only the data you care about (you supply that criteria).

It sounds like for your client table you want to Export to CSV. This gets all the columns in the table so you would have to delete all the columns except the email address.

Hope that helps.

~Paul

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: Export the e-mail addresses only...

Post by D Oliveira » 2021-09-11 17:11

Okay so just go to tablename_view.php file and you will see a CSV field list to feed the query, make simple PHP "if statements" using memberInfo array and you're all set to have different queries for differents users groups to download custom CSV files.

sblasic
Veteran Member
Posts: 53
Joined: 2021-02-22 15:55

Re: Export the e-mail addresses only...

Post by sblasic » 2021-09-14 12:00

pfrumkin wrote:
2021-09-09 15:13
Hi,

The filtering just puts conditions on the extract, to include only the data you care about (you supply that criteria).

It sounds like for your client table you want to Export to CSV. This gets all the columns in the table so you would have to delete all the columns except the email address.

Hope that helps.

~Paul
Paul, thank you for the feedback!

Yes, I thought about that - but this option is pretty "basic"...
I was thinking of some solution that will filter automatically - in my case - only the e-mail addresses of certain specialties...so I don't have to manually delete unnecessary data...

sblasic
Veteran Member
Posts: 53
Joined: 2021-02-22 15:55

Re: Export the e-mail addresses only...

Post by sblasic » 2021-09-14 12:16

D Oliveira wrote:
2021-09-11 17:11
Okay so just go to tablename_view.php file and you will see a CSV field list to feed the query, make simple PHP "if statements" using memberInfo array and you're all set to have different queries for differents users groups to download custom CSV files.
Thank you very much for your time!

D. Oliveira - I'm not a PHP programmer (but I have good knowledge in HTML and I have fair knowledge of Javascript).
So, how exactly to set the filter option (for the task: filtering certain e-mail addresses and export ONLY e-mail addresses as CSV)?

...and where is this: tablename_view.php file located? (i couldn't find it)

Could you point me out to the exact PHP coding for this task?

Thank you in advance for your help!

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: Export the e-mail addresses only...

Post by pfrumkin » 2021-09-14 15:15

Tablename_view.php is the shorthand for the magic hooks file for each table. Insert your table name for tablename in the filename, in your hooks folder. Take a look at https://bigprof.com/appgini/help/advanc ... agic-files.

@DOliveira thanks for that tip about the CSV hook. You said that and now I remember seeing it but I hadn't had cause to look at that hook.

~Paul

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: Export the e-mail addresses only...

Post by D Oliveira » 2021-09-15 10:14

pfrumkin wrote:
2021-09-14 15:15
Tablename_view.php is the shorthand for the magic hooks file for each table. Insert your table name for tablename in the filename, in your hooks folder. Take a look at https://bigprof.com/appgini/help/advanc ... agic-files.

@DOliveira thanks for that tip about the CSV hook. You said that and now I remember seeing it but I hadn't had cause to look at that hook.

~Paul
I believe the file you're referencing is tablename.php inside hooks folder, I am referring to tableview_view.php inside main app folder, your code should look like something close to this:

Code: Select all

$mi = getMemberInfo();

if($mi['group']=='Admins'){

	// Fields that can be displayed in the csv file
	$x->QueryFieldsCSV = array(
		"`tablename`.`field1`" => "Field 1",
		"`tablename`.`field2`" => "Field 2",
		"`tablename`.`email`" => "email",
	);


}else if($mi['group']=='Users'){


	// Fields that can be displayed in the csv file
	$x->QueryFieldsCSV = array(
		"`tablename`.`field1`" => "Field 1",
	);


}


pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: Export the e-mail addresses only...

Post by pfrumkin » 2021-09-15 14:59

I believe the file you're referencing is tablename.php inside hooks folder, I am referring to tableview_view.php inside main app folder
Yes of course, thanks for the check!

Post Reply