# Writing a filtered file to a specific folder depending on the path in a parameter file

**URL:** <https://forum.knime.com/t/writing-a-filtered-file-to-a-specific-folder-depending-on-the-path-in-a-parameter-file/31388>\
**Category:** KNIME Analytics Platform\
**Created:** [March 12, 2021, 12:15am UTC](https://forum.knime.com/t/writing-a-filtered-file-to-a-specific-folder-depending-on-the-path-in-a-parameter-file/31388 "2021-03-12T00:15:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harveylim](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/h/cdc98d/32.png) [@harveylim](https://forum.knime.com/u/harveylim)\
**Post date:** [March 12, 2021, 12:15am UTC](https://forum.knime.com/t/writing-a-filtered-file-to-a-specific-folder-depending-on-the-path-in-a-parameter-file/31388/1 "2021-03-12T00:15:41Z")

</div>

I would like to read in a data file and read in a parameter file. The end result I am trying to achieve is to filter out Division A transactions, create an Excel file with just the Division A transactions and put this file in the folder reserved for Division A. I would like to do the same for Division B transactions-- create the excel file for Division B transactions and put it in the folder for Division B using a loop.

In the parameter file, I have the folder path where division A transactions are supposed to go and the same for Division B etc.

When I run my workflow, all the files get created correctly but all the files are created and written to the same folder. I can’t seem to get the loop to iterate properly for the path. Can someone tell me where I am going wrong in the following workflow? Am I using the incorrect start and end loop nodes?

Thanking you all in advance

[KNIME\_project write filtered files to different folders.knwf](https://forum.knime.com/uploads/short-url/tryUjBNXNIoOBPNorTyPJNWbUt.knwf) (30.2 KB)

hl

---

<div class="post-metadata">

**Author:** ![Andrew\_Steel](https://forum-cdn.knime.com/user_avatar/forum.knime.com/andrew_steel/32/4472_2.png) [@Andrew\_Steel](https://forum.knime.com/u/Andrew_Steel)\
**Post date:** [March 12, 2021, 8:55am UTC](https://forum.knime.com/t/writing-a-filtered-file-to-a-specific-folder-depending-on-the-path-in-a-parameter-file/31388/2 "2021-03-12T08:55:53Z")

</div>

Hi @harveylim,

your loop runs only once. The node `Table Row to Variable` selects only the first row and thus selects only the first group in the `Group Loop Start` node and also creates only one file path.

Best regards  
Andrew

---

<div class="post-metadata">

**Author:** ![harveylim](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/h/cdc98d/32.png) [@harveylim](https://forum.knime.com/u/harveylim)\
**Post date:** [March 12, 2021, 2:20pm UTC](https://forum.knime.com/t/writing-a-filtered-file-to-a-specific-folder-depending-on-the-path-in-a-parameter-file/31388/3 "2021-03-12T14:20:09Z")

</div>

Hi Andrew

Thanks very much for this tip. I moved the Group Loop Start Node earlier in the process and changed a line of code in the rule based row filter node. It now works fine as shown in the workflow.

Cheers,

Harvey

[KNIME\_project write filtered files to different folders SOLUTION.knwf](https://forum.knime.com/uploads/short-url/ooGSArDYKt0edMataZE9djJfRgY.knwf) (29.6 KB)

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [March 19, 2021, 2:20pm UTC](https://forum.knime.com/t/writing-a-filtered-file-to-a-specific-folder-depending-on-the-path-in-a-parameter-file/31388/4 "2021-03-19T14:20:24Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
