Hello @DR and welcome to Microsoft Q&A.
Please help me verify I understand you ask correctly.
You have a source data you are doing a lookup on, data is something like
Num, Text
1, abc
2, def
3 ghi
4 jkl
...
8, tuv
9, wxy
10, ZZZ
You want to take each row and create a file for each, named as <Num>.txt
. This is done somehow inside a ForEach loop, iterating over the output of the lookup. I'm guessing there is SQL involved somewhere.
The problem you are seeing is processing the same item multiple times. Please let me know if there is a Set Variable activity inside the ForEach loop. The behavior you have described matches some of my experiments with what happens to a Set Variable activity inside a non-sequential loop.
From those experiments, I learned there is only 1 "slot" for a variable. All reads and writes access this same "slot". This means when the simultaneous instances of the loop activate, they can interfere with each other. This is called a "race condition". The main solutions is to either make the loop sequential, or to be clever with the Dynamic Expression so you do not need to use the Variable.