Hi @TomUsingKNIME , yes it does.
I put something together that allows you to determine which Customer data goes in which file. You can then implement the rest to write to the CSV files.
The workflow looks like this (description of the nodes included):
I used a variable to define the max of rows per file, in your case it will be 2500. Since I don’t have a huge sample data, I set mine at 5:
I created a sample data of this:
And the results at the end is this:
As mentioned above, I set my workflow for a max of 5 rows per csv file, so in my sample data, Customer A’s and B’s data will go in the same batch (3A + 2B = 5).
Customer C’s data will go in a batch, and nothing else can go in, since C has 4 rows, and D has 3 rows. Therefore, Customer C’s data will go in a new batch, and Customer D’s data will go in another new batch.
From there, you can use a group loop on Batch, and write to csv. You can use the Batch number to create your csv file name dynamically.
Here’s the initial workflow:
Split data into multiple CSV based on some conditions.knwf (32.0 KB)
Let me know if you have trouble implement the write to csv files. Alternatively, you can also try to write to the csv files inside the current Loop. Let me know if you need help.
EDIT: I got bored and wanted to implement the rest for writing to the csv files
Updated workflow looks like this:
I also defined a file name template for the split files, that way you can change it easily there:
Just keep the ##NUM## which is what will take the numbering of the files.
After running it, it created the 3 csv files:
Here’s the updated workflow: Split data into multiple CSV based on some conditions.knwf (36.8 KB)