Here I want to share with you one solution to the problem of how to write multiple CSV files using a loop based on column values.
Hello @CarlosEnrique84,
you have Group Loop for this use case. So you can avoid Group By and Row Filter nodes.
Something like this only updated to have nodes from newer versions:
Additionally this topic is more suited for Knowledge Sharing
Br,
Ivan
Hi Ivan! Thank you for the feedback!
Carlos
Hijacking / necroposting :
I am trying to do something that I believe is similar, but fail to do so (so far).
I have a pretty big dataset, I want to filter it by “country” and output it as c:\path_to_file$$country$$.csv
I have copied your workflow, but can’t seem to filter the loop on the current country being read. What am I missing ?
EDIT : figured out the loop part, can’t choose a path though, it stores right in “my docs”, which I rather avoid thx for help
Please share your sample data and workflow.
That’s what it looks like. I figured out how to loop and output data to “ISO2.csv” for each country code I have.
What I can’t figure out is how to tell knime to write those excel files in a specific folder…
I am grabbing the hub (country) code and looping it to make a XX.xlsx filename variable
Then string to path (I think that’s the node I am missing something).
Then excel write :
Hello @Startide,
these days I use a bit different design making use of Create File/Folder Variables node.
Take a look here (you don’t need SMB or any other connector node if you are writing data locally):
Br,
Ivan
That looks a lot more on point, I found a workaround with the string manipulation node by hardcoding my path in the variable :
join(“G:\docs\test new\”, $${SHub (#1)}$$, “.xlsx”)
I need to figure out how that node of yours works now
EDIT : can’t find that “variable expressions” node in my knime, is that an addon to install ? Also : how do you loop around with your example ?
Hello @Startide,
you workaround seems just fine.
Variable Expression is part of KNIME Expressions extension. You can also see it here:
To have it in a loop replacing String Manipulation (Variable) and String to Path (Variable) with 2 nodes I mentioned should be sufficient.
Br,
Ivan