The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Is there any way to push the output value of forEach activity to an outer variable?
E.g.
For example,
Lookup is a SQL look up that returns following and Filter activity filters based on filter_action = 'include'
// output value Lookup
{
"count": 2,
"value": [
{
"id": 1,
"filter_action": "include"
},
{
"id": 2,
"filter_action": "include"
},
{
"id": 3,
"filter_action": "exclude"
}
]
}
//output value Filter
{
"ItemsCount": 2,
"FilteredItemsCount": 2,
"Value": [
{
"id": 1,
"filter_action": "include"
},
{
"id": 2,
"filter_action": "include"
}
]
}
I am storing the output of filter in a variable and based on the array in Filter I am doing Copy Activity forEach objects present in Value array of Filter.
While the copying is taking place forEach ingestion how can I access the outer Variable to copy the output of Copy Activity in the same variable.
Equivalent Javascript code of what I am hoping to achieve in pipeline
Is it doable?
Solved! Go to Solution.
If your variable is of type 'Array', then the 'Append variable' activity can be used inside each foreach iteration to dynamically append new items to the array variable.
Append variable activity - Microsoft Fabric | Microsoft Learn
Afterwards, the array variable (with the data from the foreach activity) will be accessible for subsequent pipeline activities outside of the foreach activity.
I think the Collection functions are useful for accessing the data from the array variable in subsequent steps:
Expressions and functions - Microsoft Fabric | Microsoft Learn
Also other functions and activities can be useful.
If your variable is of type 'Array', then the 'Append variable' activity can be used inside each foreach iteration to dynamically append new items to the array variable.
Append variable activity - Microsoft Fabric | Microsoft Learn
Afterwards, the array variable (with the data from the foreach activity) will be accessible for subsequent pipeline activities outside of the foreach activity.
I think the Collection functions are useful for accessing the data from the array variable in subsequent steps:
Expressions and functions - Microsoft Fabric | Microsoft Learn
Also other functions and activities can be useful.
Hi @smpa01 ,
Currently Data Factory supports Run a Script activity and send an output summary by email.
I think you can create a Data pipeline and then select Script in the Activities.
Then break it down in detail based on the formatting that needs to be changed.
Eventually it would be possible to push the internal forEach activity to an external email as a Script.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
3 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
5 | |
4 | |
3 | |
2 | |
2 |