Support

Home Forums Event Espresso Premium Registrations CSV Export – SQL query

Registrations CSV Export – SQL query

Posted: September 14, 2018 at 10:30 am


FINS SWIMMING

September 14, 2018 at 10:30 am

Hi,

The filtered “Approved” registrations CSV export with all data columns is very helpful, however I would like to run a few reports on the database, trimming out un-needed columns and making custom reports for my team.

I was wondering if you have a SQL query handy that will give me the same data as what gets exported in the CSV export.

Thanks!


Josh

  • Support Staff

September 14, 2018 at 10:49 am

Hi,

I do not have an SQL query handy that would replicate CSV report. There are a lot of relationships between tables with that particular report, and Event Espresso 4 uses a model system which basically handles all the tricky SQL joins. So even if you look in the source, you will not see SQL queries there.

What you could do is install one of the plugins like WP_DEBUG bar and then add:
define( 'SAVEQUERIES', true );
to your site’s wp-config.php file. Then when you run a report via the Registrations page, you can click on the Debug bar and view all the queries that just happened.

Or, if you’re really just looking to trim the columns, you can make use of the FHEE__EE_Export__report_registrations__reg_csv_array filter hook and have the unwanted columns trimmed away when you run the report from the UI.

Here are some links to some code examples that can be followed & added to a plugin on your site:
To specify the columns you want:
https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/registration_report_limit_columns_shown.php
To specify the columns you do not want:
https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/tw_registration_report_exclude_fields.php


FINS SWIMMING

September 14, 2018 at 10:58 am

Excellent! That is super helpful. Thanks as always, Josh.

The support post ‘Registrations CSV Export – SQL query’ 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