Plugin Author
Franky
(@liedekef)
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.
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
(@liedekef)
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.
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.
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
(@liedekef)
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 🙂
Thanks, i’ll look into it.