Hello,
I am running into an odd issue when using custom ordering of CSV columns from user registrations. The ordering is working fine but when a question is removed from a group that my custom CSV columns array has in it, the csv will export that column with a number in the column (I’m assuming the index of the question).
So for example if my custom columns are id, name, and height and I remove the height question, in my CSV the height column will still export and populate with 3 on all registrations.
I am using the filter FHEE__EE_Export__report_registrations__reg_csv_array and passing it an ordered array to list the columns
So I have a couple questions. Is it possible to just set these missing columns to return nil/an empty string instead of the question index OR only export the data column IF that question actually exists as part of the registration questions?
That an interesting problem I hadn’t thought of when creating that snippet.
The number you can see if the index of the allowed_fields_in_order array, once its flipped (using array_flip()) so that fields you set are used for the keys, the numeric index becomes the value, then array_merge is using the value.
So the simplest fix is to set the value of each element in the allowed_fields_in_order array to an empty string so even if the value is used its empty.
If you copy the highlighted section from my code and replace the code in your snippet with that (basically everything outside of creating your order array) it should fix the problem for you.
You’re most welcome, I’m glad that worked for you.
Viewing 3 reply threads
The support post ‘Custom Ordered CSV Columns Issue’ 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.
Support forum for Event Espresso 3 and Event Espresso 4.