Page 1 of 1

Export the e-mail addresses only...

Posted: 2021-09-09 08:30
by sblasic
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!

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

Posted: 2021-09-09 15:13
by pfrumkin
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

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

Posted: 2021-09-11 17:11
by D Oliveira
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.

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

Posted: 2021-09-14 12:00
by sblasic
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...

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

Posted: 2021-09-14 12:16
by sblasic
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!

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

Posted: 2021-09-14 15:15
by pfrumkin
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

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

Posted: 2021-09-15 10:14
by D Oliveira
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",
	);


}


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

Posted: 2021-09-15 14:59
by pfrumkin
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!