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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jkrumb
Regular Visitor

Fabric pipeline - ForEach Variable data to Warehouse

Hello everyone,
As you can see in the image, inside the red box on the right, these are the types of values I would like to insert into the data warehouse. I retrieve these values from a ForEach loop containing a variable. As you can guess, I would like to insert all the data from the variable into the data warehouse.

 

jkrumb_0-1748440831199.png

 

jkrumb_1-1748441136031.png

 

Thank's you for your help.

 

JK

 

1 ACCEPTED SOLUTION
v-tsaipranay
Community Support
Community Support

Hello @jkrumb ,

Thank you for reaching out to Microsoft fabric community form.

 

To insert values from a ForEach loop into a Data Warehouse within Microsoft Fabric, you can use the ForEach activity to iterate over your array or list of items. Inside the loop, add a Copy Data or Stored Procedure activity that handles the insertion logic.

You can reference each item dynamically using the @item().propertyName expression, which allows you to pass values from the current iteration into your sink (e.g., a Warehouse table).

For reliable execution, especially when dealing with insertions or variables, it's recommended to set the loop mode to sequential, as variables and some operations are not thread-safe in parallel mode. If you require more advanced logic (e.g., dynamic SQL), consider using the Script activity within the loop.

 

For more details, refer to the official Microsoft Fabric documentation on ForEach activity, which outlines usage patterns and best practices.

 

If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.

 

Thankyou.

View solution in original post

6 REPLIES 6
v-tsaipranay
Community Support
Community Support

Hi @jkrumb ,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

v-tsaipranay
Community Support
Community Support

Hi @jkrumb ,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


Thank you.

v-tsaipranay
Community Support
Community Support

Hello @jkrumb ,

Thank you for reaching out to Microsoft fabric community form.

 

To insert values from a ForEach loop into a Data Warehouse within Microsoft Fabric, you can use the ForEach activity to iterate over your array or list of items. Inside the loop, add a Copy Data or Stored Procedure activity that handles the insertion logic.

You can reference each item dynamically using the @item().propertyName expression, which allows you to pass values from the current iteration into your sink (e.g., a Warehouse table).

For reliable execution, especially when dealing with insertions or variables, it's recommended to set the loop mode to sequential, as variables and some operations are not thread-safe in parallel mode. If you require more advanced logic (e.g., dynamic SQL), consider using the Script activity within the loop.

 

For more details, refer to the official Microsoft Fabric documentation on ForEach activity, which outlines usage patterns and best practices.

 

If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.

 

Thankyou.

Hi @jkrumb ,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


Thank you.

burakkaragoz
Community Champion
Community Champion

Hi @jkrumb ,

 

To insert values from a ForEach loop into your Data Warehouse, you can follow this approach:

  1. Inside the ForEach activity, use a Copy Data activity
  2. Set the source as the variable or dataset you're iterating over
  3. Set the sink (destination) to your Data Warehouse table
  4. Make sure the schema mapping is correctly defined so each iteration inserts the expected values

If your variable is an array of objects, each iteration will handle one object. You can also use a Script activity if you need more control over the insert logic (like using dynamic SQL)

Let me know if you need help with the exact pipeline setup

If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.

Thank's,

jkrumb_0-1748445985601.png

 

My value var2 :

{
  "id": @{json(item())?['id']},
  "name": @{json(item())?['name']},
  "refreshType": @{first(activity('Web1').output.value)?['refreshType']},
  "endTime": @{first(activity('Web1').output.value)?['endTime']},
  "status": @{first(activity('Web1').output.value)?['status']}
}
How configure source copy data ?
jkrumb_1-1748446172635.png

 

 

Thank's you ?

Helpful resources

Announcements
Fabric July 2025 Monthly Update Carousel

Fabric Monthly Update - July 2025

Check out the July 2025 Fabric update to learn about new features.

July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.