Hi Pieter,
I downloaded the example file as suggested from ttps://www.rabobank.nl/images/voorbeeldbestand-csv-extensie-excel_29933460.zip .
I am able to import the data successfully. Here is my example. The dummy CSV file is saved in my resources folder as “test.csv”. I haven’t named all the attributes in the CSV entity as Dutch isn’t my first language.
Firstly I load the test.csv file from my resources directory using the GetFileContentsFromResource action from the Community Commons library. I pass this into ImportCSV.
My ImportCSV action looks like this.
This calls my ReadLine_CSV microflow. This iterates every line, adding to a list, before finally committing it.
I hope this helps you!
When I’ve used the CSV module I’ve had my equivalent of the EntryLineFromCSV entity as a non persistent entity with no associations.
Your “Read Next Line” should populate EntryLineFromCSV when it reads the line. If this is empty, it’s the end of the file. I would use this to create a new Entry and persist this. Remember to then loop back to call “Read Next Line” again if your EntryLineFromCSV wasn’t empty.
Hi Robert, thanks for your response. I've changed the domain model, it now looks like:
The MF to invoke in the Import CSV action looks as follows:
Now, 3 EntryLineFromCsv objects are created (the CSV-file contains 3 rows). However, how do I get all the data from the CSV into the different attributes of the EntryLineFromCsv?
Thanks!