Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the community forum?
All Topics
Daniel

CSV Export: split column value into multiple columns

Hey guys,

we’re currently thinking about how to achieve the following task most efficiently (if possible at all):

When exporting a column set, split the values of a specific column (an ACF relation field, values separated by comma per default) into multiple columns in the resulting csv.

We’re aware that there are ways to achieve this in excel as well but the request was clearly that, if possible, do it directly on export.

I believe this involves some (maybe harder) logic to alter/parse the csv after all rows are processed because only then the amount of additional columns are known. Is there any way you could think of. Currently I’m only aware of this filter by which is not what would be needed here: https://www.admincolumns.com/documentation/filter-reference/acp-export-value/

It would involve adding a new column type, maybe?

Thanks for any hints on this.

1 week, 4 days ago
Daniel

urgs, sorry for this bad wording…the post wasn’t finished yet. unfortunately, no way to edit it after submission. :/

1 week, 4 days ago
Stefan
Developer

Unfortunately, there is no way to do this right now. Our export feature really relies on the table screen columns and there are no hooks in place to add extra columns to the exported file.

But I think that introducing two new hooks to alter both the headers and the values could work for you.
I’ve created a feature request for this and made already some change in our code to test the use case.
I would like to discuss this change with my colleagues though before merging it in our core.

You can follow this request on Github if you like.
https://github.com/codepress/admin-columns-issues/issues/1250

1 week, 2 days ago
Daniel

Hey Stefan,

alright, but great to hear that you think about adding such hooks.
subscribed to the github issue already.

that should work for us, thanks.

BTW: I noticed that the filter hooks ac/column/value and ac/export/value use the same function parameters but in a different order. If they’d use the same order, I could’ve used the exact same code to modify some column data for csv export as well as the admin table screen view. Thus, my code that hooks in both these filters is rather redundant. I understand that changing this now might break some functionality on the customers side, though.

1 week, 2 days ago
Stefan
Developer

You’re welcome and you’re totally right, putting the order of the params for both hooks the same is definitely better than what we have now, but as you already mentioned, we can’t simply change that now. I will close this topic since you already subscribed for the Github Issue.

1 week, 2 days ago

You must be logged in to reply to this topic.