Help with Loop and saving different txt files based on row value

Hi Community,

I am having trouble doing a split based on row value. Let me give you a few details:
I have a txt file with a big string in it(max length 142 characters). It consists of various info, including date, customer number, store code and inventory units.(see attached sample- store code is the “GRCO01”, “GRCO25” etc))
What i want to do is split the file based on the date and based on the store code, save it in a different .txt file and give it a specific name (e.g. “Store Code”_“Date”.txt)
Reading vba examples in excel, i thought that extracting the store code in a different column would be good, so i can use that as a reference to save the file and give it the first half of the final file name…Getting to the loop part of the workflow i am completely clueless, i cant seem to be able to get it right creating multiple errors…

Can you help with your superior knowledge ?

test_source.txt (27.2 KB)
split file and save.knwf (12.5 KB)

Hello vpetrou,

maybe use “\t” as delimiter in the CSV reader. Then you obtain a table with the different columns and you should be able to work on that.
Does that help you?

  • Moritz

sure,but my main problem is the loop and how to create the split files based on multiple row value. any java script to handle that issue ?

Hi vpetrou,

Here is my solution. I hope, it does what you expect.

Martin K. (43.7 KB)

1 Like

Without Java script !Wow, thank you very much it does exactly what i wanted !
thank you !