Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

60 Days of Data Days! Live and on-demand sessions, challenges, study groups and more! And it's all FREE!. Join now. Learn more

Reply
amaaiia
Skilled Sharer
Skilled Sharer

Isolated variable inside loop iteration

Is there a way to have a variable that is only affected by one iteration within a loop activity? I mean, I have a variable var1 and it is updated within a loop, but I want that variable to affect only the particular iteration. That is, if I run 3 iterations at the same time, as all iterations modify the same variable var1, their values are overlapping. However, what I need is an isolated variable in each iteration. Is this possible?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @amaaiia 
Data Factory pipelines don't directly support loop-specific variables. 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @amaaiia 
Thanks for using Fabric Community.
Data Factory pipelines don't directly support loop-specific variables. However, you can try this:

Use Set Variable Activity:

  • Inside your loop, include a "Set Variable" activity before your logic that modifies the original var1.
  • Within the "Set Variable" activity, define a new variable specific to the iteration. 
  • Modify this newly created variable within the loop.

 

This might be helpful in your case. You can refer to this link for more help:
How to create iteration scoped variables inside ForEach activities in Azure Data Factory - Stack Ove...

Hope this helps. Please let me know if you have any further questions.




Hi @Anonymous 

I don't understand. If I define new variable inside loop, imagine var2, var2 will be updated in each iteration too.

Anonymous
Not applicable

Hi @amaaiia 
Data Factory pipelines don't directly support loop-specific variables. 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon โ€“ Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save โ‚ฌ200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.