Support

Home Forums Event Espresso Premium Export registration custom fields

Export registration custom fields

Posted: September 22, 2016 at 5:15 am

Viewing 13 reply threads


iproject

September 22, 2016 at 5:15 am

Hi! I know that the custom export is still on the go. I would like to know where are the files involved in the csv export or a bit of advise to achieve hidding fields on the csv exported file.
It could be nice to have on the database a ‘flag’ to show or hide each field on the csv 😉
Thank you!
Guillermo


Tony

  • Support Staff

September 22, 2016 at 6:17 am

Hi Guillermo,

It sounds like you want to exclude specific fields from the CSV (or only include specific fields within the CSV) is that correct?

If so we filters in place that allow you to do that.

This function only allows the columns you specify to be added to the CSV:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/registration_report_limit_columns_shown.php

The function allows you to set which columns to exclude and all others will continue to be used:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/tw_registration_report_exclude_fields.php

You can use either of those to do the above, you just need to add your columsn adn then add the function to either your functions.php file or a Site Specific Plugin.


iproject

September 23, 2016 at 3:32 am

Thank you! It works 🙂
Another related question: I need to change the comma separator to ‘;’ to open it on my excel (spanish excel). Where can I do the trick?
Thank you very much!
Guillermo


Tony

  • Support Staff

September 23, 2016 at 5:08 am

Hi there,

We don’t currently have the option to change the separator used in the CSV, however we do have a filter that allows you to tell whichever program you are using which seaprator was used for the file:

add_filter( 'FHEE__EE_CSV__begin_sending_csv__start_writing', 'ee_specify_comma_seperator' );

function ee_specify_comma_seperator( $initial_csv_output ) {
    $initial_csv_output .= "sep=,\n";
    return $initial_csv_output;
}


iproject

September 23, 2016 at 5:13 am

Thank you!
Last questions :
1- Is it possible to rename the fields on the CSV? (I mean the header fields, for example: ‘Transaction ID[TXN_ID]’ to -> ‘Id’
2- Is it possible to reorder the CSV fields?


iproject

September 23, 2016 at 5:39 am

Hi Tony!
I tryied with your filter: FHEE__EE_CSV__begin_sending_csv__start_writing
and it didn’t work…. but I found the filter I just asked for!

Here is my function over functions.php on my theme:

function ee_csv_comma_seperator( $initial_csv_output ) {
// Be sure to use the delimiter you want. I my case is = ;
$initial_csv_output = ‘;’;
return $initial_csv_output;
}
add_filter( ‘FHEE__EE_CSV__fputcsv2__delimiter’, ‘ee_csv_comma_seperator’ );

Is there a filter / action list of events espresso somewhere?


Tony

  • Support Staff

September 23, 2016 at 6:05 am

Ah, my apologies, I completely forgot about those filters!

Is there a filter / action list of events espresso somewhere?

Not currently however all of our hooks are prefxied with FHEE (Filter Hook Event Espresso) and AHEE (Action Hook Event Espresso) so they should be easy to find.

FOr more info on the naming convention we use for hook see here:

https://github.com/eventespresso/event-espresso-core/blob/master/docs/A–Best-Practices/ee-actions-and-filters.md

1- Is it possible to rename the fields on the CSV? (I mean the header fields, for example: ‘Transaction ID[TXN_ID]’ to -> ‘Id’

All of the headers within the CSV should be translatable so you can use the function here:

https://eventespresso.com/wiki/how-to-change-wording-with-poedit/#custom-function

2- Is it possible to reorder the CSV fields?

It is, you would use the same filter from here:

https://eventespresso.com/topic/export-registration-custom-fields/#post-217902

Whatever order you return the details from the filter is the order in which they will be output.


iproject

September 24, 2016 at 2:33 am

Hi! Thank you for the fast replies 😉

I have tried this code to alter the CSV columns order, but the column fields doesn’t order correctly (First should be: ‘Nombre de pila’ and after ‘Transaction ID’. But it appears the Transaction ID as first column)

Can you have a look at it? It seems that the order I use in the array doesn’t affect the CSV order.

//only include these 4 columns in the registration CSV output
add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'espresso_reg_report_filter_columns', 10, 2);
function espresso_reg_report_filter_columns( $csv_row, $registration_db_row ) {
	$filtered_csv_row = array_intersect_key(
			$csv_row,
			array_flip( array(
		__( 'Nombre de pila[ATT_fname]', 'event_espresso' ),
		__( 'Transaction ID[TXN_ID]', 'event_espresso' ),
		'radio',//custom question's admin label, doesn't need to be translated. note though: if you ever change the custom question's admin label, this code will need to be adjusted
				) ) );
	return $filtered_csv_row;
}


Tony

  • Support Staff

September 26, 2016 at 6:08 am

Can you have a look at it? It seems that the order I use in the array doesn’t affect the CSV order.

I’m sorry, I should have been clearer as that isn’t what I meant above.

Changing the order in the array you have currently will not change anything within the output as its just a list for array_intersect_key() to know which fields to return. Meaning $filtered_csv_row is still in the same order regardless of what order you us prior to that.

You use the same filter, but will need to modify the function to return a custom order, take a look here:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/tw_ee_registration_report_limit_columns_shown.php


iproject

September 27, 2016 at 3:24 am

Thank you Tony! It works perfectly! Just what we need 🙂
I think I have my last question: My wordpress is on utf8 ( wp-config: define(‘DB_CHARSET’, ‘utf8mb4’); )
When I export, some none-english characters doesn’t show correctly. For example: ó as ó
Is there a nice way to force the .csv file to be opened as utf-8 on excel or openoffice?


Josh

  • Support Staff

September 27, 2016 at 8:59 am

You might be interested in this stack exchange thread that answers your question:

http://stackoverflow.com/questions/6002256/is-it-possible-to-force-excel-recognize-utf-8-csv-files-automatically


iproject

September 27, 2016 at 5:44 pm

Thank you!
One more 😉 I have been looking for it on the forum but cannot find it:
How can I export on the csv ONLY the “completed” / “payed” transactions?


Josh

  • Support Staff

September 28, 2016 at 7:48 am

How can I export on the csv ONLY the “completed” / “payed” transactions?

That’s actually a feature the dev team will need to add before you can do that. We’ll update this thread once that’s been added so you’ll know when it’s ready.


Josh

  • Support Staff

January 3, 2017 at 2:54 pm

Hi there,

I wanted to let you know that a new “Filtered CSV Report” button was added to Event Espresso version 4.9.24.p. This new button will start a report that uses the filters on the admin registration list table. You can use this new feature to do a filtered report such as registrations that have a specific Registration status.

Viewing 13 reply threads

The support post ‘Export registration custom fields’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso