Gruber
Member
Hey there!
I'm playing around with the CSV import of Fabrik. I was wondering how to deal with a CSV file with multiple data from the same row that should be applied to different tables. Since I'm working on a Book Archive project, I'll receive a CSV file with single book data per row like title, description, author, genres, and so on... I found that Fabrik has the nice "listCSV" plugin that allow to execute PHP on every single row data import, exactly what I need!
This way I can do a specific database operation with each row so that the author data from the row can be inserted in the author table, the genres in the Many - to Many relationship table and so on...
... but how can I retrieve the data from the row when it's imported (or better before it's imported)? and store it in an object/array?
Unfortunately I can't find much about this in the docs of the plugin, then I noted in the code comments on the page:
So I think that basically I can use much of the functionality of the PHP form plugin...
if that's the case, can I just skip the database query part in my script and simply set direclty each row data field inside the corresponding fields of my form? (this because I've set up my form to interact with multiple tables in my database). Can I do this also with joined list form fields?
I'm playing around with the CSV import of Fabrik. I was wondering how to deal with a CSV file with multiple data from the same row that should be applied to different tables. Since I'm working on a Book Archive project, I'll receive a CSV file with single book data per row like title, description, author, genres, and so on... I found that Fabrik has the nice "listCSV" plugin that allow to execute PHP on every single row data import, exactly what I need!
This way I can do a specific database operation with each row so that the author data from the row can be inserted in the author table, the genres in the Many - to Many relationship table and so on...
... but how can I retrieve the data from the row when it's imported (or better before it's imported)? and store it in an object/array?
Unfortunately I can't find much about this in the docs of the plugin, then I noted in the code comments on the page:
[...]get a reference to the form model - as we are importing line by line, the form model contains the current data that we are going to submit to the table.
So I think that basically I can use much of the functionality of the PHP form plugin...
if that's the case, can I just skip the database query part in my script and simply set direclty each row data field inside the corresponding fields of my form? (this because I've set up my form to interact with multiple tables in my database). Can I do this also with joined list form fields?