Variable control and file output

Good afternoon. I'm tying to us Knime to split a file by a data value. For example, any record where the value in field x is alpha, it should be written to alpha.csv. I've mostly solved this, I believe, using a variable loop similar to the variable example and a java snippet. My problem is that the file writer cannot finish before the next iteration starts and so I end up with 18 files (18 values in x) of 0 length. Has someone tried to tackle this or is there a better way to do this?

Is the file writer node part of the loop body? You need something like

Loop Start -> Row Filter -> CSV Writer -> Loop End

Obviously you can't connect the CSV Writer with the loop end node (unless you use the new flow variable ports that came with v2.2) but you can connect the loop end node to the row filter and it will have the same effect: The loop end node will wait for the CSV Writer to finish before the next iteration starts.

Bernd