Title: Question about csv export
Last modified: June 28, 2019

---

# Question about csv export

 *  Resolved [tommienl](https://wordpress.org/support/users/tommienl/)
 * (@tommienl)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/question-about-csv-export/)
 * Hello Franky,
 * Now I’ve got the repetition working (_repeat form fields when multiple seats 
   are selected_) I’d like to export all my registrations and use this in Excel 
   or Access for example. When I use the ‘export to CSV’ function the main registration
   fields appear comma separated: ID,”First Name”,”Age” etc. (_with on the second
   row the values_) This can ben imported easily.
 * But the extra generated fields are exported in separate rows starting with:
    “,”
   1.0 FIELD VALUE “,”1.1 FIELD VALUE “,”1.2 FIELD VALUE etc.
 * Is there a way to also export these extra generated fields (_with values_) in
   a comma separated way?
 * For example what I would have expected: ID,”First Name”,”Age”, “1.0 Name”, “1.0
   Age”, “1.1 Name”, “1.1 Age” and on the second row the values.
 * Greets Tommienl

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Franky](https://wordpress.org/support/users/liedekef/)
 * (@liedekef)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/question-about-csv-export/#post-11681512)
 * You just explained why it isn’t that simple for dynamic fields: because of possible
   repetition, I don’t know how many answers columns belong to a certain field (
   or group of fields). So one booking could have 5 fields, another 10, etc …
    That’s
   why for the dynamic fields, the export includes the name in the field export,
   and not on the header line. Now the fact that the export includes newlines is(
   I think) still a leftover (libreoffice handles this better). Could you remove
   the last “\n” part in eme_people.php line 834 and try again?
    -  This reply was modified 6 years, 11 months ago by [Franky](https://wordpress.org/support/users/liedekef/).
 *  Thread Starter [tommienl](https://wordpress.org/support/users/tommienl/)
 * (@tommienl)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/question-about-csv-export/#post-11681820)
 * Hello Franky, thnx for the quick reply.
 * I changed line 834 of eme_people.ph to:
 * `$line[]="$grouping.$occurence ".$tmp_formfield['field_name'].": ".eme_answer2readable(
   $answer['answer'],$tmp_formfield,1,"||","text")."";`
 * The export is now neatly on 2 lines!
 * The headers are now _1, _2, _3, etc for the dynamic field. Probably the challenge
   for me to import this correctly (_match \_1 to field name & extract the value
   also_ ) to Excel or Access.
 * Many thanks for the support, is this something you will push to your code?
 * Greets
 *  Plugin Author [Franky](https://wordpress.org/support/users/liedekef/)
 * (@liedekef)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/question-about-csv-export/#post-11681845)
 * Importing something like this will cause the same issues (I don’t understand 
   why anybody would import from one db in another …). Imagine you have a template
   with 5 fields that can get repeated (those fields belong together), and then 
   another template that gets repeated based on another condition etc … EME works
   with groups of responses just for that (which explains the “x.y” part followed
   by the fieldname in each answer: first the group number, then the repetition 
   number). Importing this in another DB will be very hard to do (if not impossible).
   
   Concerning the change itself: yes, it will be in the next version. Also: the 
   change just changes the answers, not the first line. I don’t add headers (on 
   the first line) for dynamic fields.
    -  This reply was modified 6 years, 11 months ago by [Franky](https://wordpress.org/support/users/liedekef/).
 *  Thread Starter [tommienl](https://wordpress.org/support/users/tommienl/)
 * (@tommienl)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/question-about-csv-export/#post-11681943)
 * To be complete:
 * **Importing something like this will cause the same issues (I don’t understand
   why anybody would import from one db in another …).**
 * Why were doing this: we are using your plugin to make it possible to register
   a parent (_adult_) with multiple children for a 5 day event (_during the days
   some 250 kids / 300+ adults_). During these 5 days multiple components are organised.
   We need to plan the parent (_adult_) to help on these days (_with games / group
   surveillance / medical support / kitchen / etc / etc_). The kids are planned 
   to groups (_10 kids per group, selected on age and school_). After this planning
   we want to display this to the kids & parents so they know what to do/expect.
 * **Imagine you have a template with 5 fields that can get repeated (those fields
   belong together), and then another template that gets repeated based on another
   condition etc … EME works with groups of responses just for that (which explains
   the “x.y” part followed by the fieldname in each answer: first the group number,
   then the repetition number). Importing this in another DB will be very hard to
   do (if not impossible).**
 * For our particular case there is only one repeating template with a default set
   of fields (_for the registered children_). Because this is repeated and there
   is some kind of key (“x.y”) i probably can extract or filter this later on.
 * **Concerning the change itself: yes, it will be in the next version.**
    Ok, cool
 * **Also: the change just changes the answers, not the first line. I don’t add 
   headers (on the first line) for dynamic fields.**
 * I see (_when I open de .csv in an editor_). The headers i noted (_1, _2, _3 etc)
   are probably generated by the *.csv import module of Microsoft Excel.
 *  Thread Starter [tommienl](https://wordpress.org/support/users/tommienl/)
 * (@tommienl)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/question-about-csv-export/#post-11681957)
 * If you have tips on how to do this more efficient i’m always open to ideas. But
   at the moment I don’t see any other way at the moment to be able to plan al the
   different components for all the parents and children.
 * Again, thanks for the quick replies.
 *  Plugin Author [Franky](https://wordpress.org/support/users/liedekef/)
 * (@liedekef)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/question-about-csv-export/#post-11682020)
 * Well, if you’re used to working with wordpress as an API, you can check the function
   eme_csv_booking_report in eme_people.php. It has all the calls:
    First (simplified):`
   $bookings = eme_get_bookings_for($event_id);` Then, foreach booking:
 *     ```
         $person = eme_get_person ($booking['person_id']); // get the person
         $person_answers = eme_get_person_answers($booking['person_id']); // get answers related to the person
         $answers = eme_get_nodyndata_booking_answers($booking['booking_id']); // get non-dynamic answers related to the booking
         $answers = eme_get_dyndata_booking_answers($booking['booking_id']); // get dynamic answers related to the booking
       ```
   
 * The code itselfs shows how I work with each, but that’s the logic 🙂
 *  Thread Starter [tommienl](https://wordpress.org/support/users/tommienl/)
 * (@tommienl)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/question-about-csv-export/#post-11682147)
 * Thanks, i’ll look into it.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Question about csv export’ is closed to new replies.

 * ![](https://ps.w.org/events-made-easy/assets/icon-256x256.png?rev=1856035)
 * [Events Made Easy](https://wordpress.org/plugins/events-made-easy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-made-easy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-made-easy/)
 * [Active Topics](https://wordpress.org/support/plugin/events-made-easy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-made-easy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-made-easy/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [tommienl](https://wordpress.org/support/users/tommienl/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/question-about-csv-export/#post-11682147)
 * Status: resolved