Home › Forums › General Issues › Import data from CSV, sort and add the data into rows of a repeater field. › Reply To: Import data from CSV, sort and add the data into rows of a repeater field.
I can’t say I’ve ever seen any documentation on this.
I thought you were looking for information on everything from parsing the CSV to how to store the data.
Sorting the repeater fields.
I would create an acf/save_post hook that runs after ACF is done. I would then extract all of the data from the repeater field into and array and then insert it all back into the repeater field in the order that I wanted. I think this might be the only way.
Making sure it was imported only once, basically you’d need to delete all of the data currently in the repeater before importing so that the import overwrites everything that’s already in there. Either that or you have to perform a check on every field and the content in the field to see if it already exists before insertion. Most import tools go with the “Delete everything and then reinsert” model.
If you’ve been looking at storing data for acf repeater fields then you already know that it is a complex issue.
Like I said above, I don’t know of much information on doing any of this, what I’ve figured out was basically by digging through the database and the acf code to figure out how it works.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.