Skip to content

Commit ae63208

Browse files
authored
Merge pull request #63826 from chez-charlie/release-branch-1
Aggregating Foreach output
2 parents eefa05c + 6b9bc40 commit ae63208

File tree

1 file changed

+5
-99
lines changed

1 file changed

+5
-99
lines changed

articles/data-factory/control-flow-for-each-activity.md

+5-99
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.workload: data-services
1212
ms.tgt_pltfrm: na
1313

1414
ms.topic: conceptual
15-
ms.date: 11/26/2018
15+
ms.date: 01/23/2019
1616
ms.author: shlo
1717

1818
---
@@ -232,6 +232,7 @@ It's possible to iterate over multiple activities (for example: copy and web act
232232
}
233233

234234
```
235+
235236
### Example
236237
**Scenario:** Iterate over an InnerPipeline within a ForEach activity with Execute Pipeline activity. The inner pipeline copies with schema definitions parameterized.
237238

@@ -466,108 +467,13 @@ It's possible to iterate over multiple activities (for example: copy and web act
466467
]
467468

468469
}
469-
470470
```
471-
## Aggregating metric output
472-
Expression for gathering the output of all the iterations of a ForEach is `@activity('NameofInnerActivity')`. For example, if a ForEach Activity iterated over a "MyCopyActivity," the syntax would be: `@activity('MyCopyActivity')`. The output is an array, with each item giving details about a specific iteration.
473471

474-
> [!NOTE]
475-
> If you want details about a specific iteration, the syntax would be: `@activity('NameofInnerActivity')[0]` for the latest iteration. Use the number in the brackets to access the specific iteration of the array. To access a specific property of a specific iteration, you would use: `@activity('NameofInnerActivity')[0].output` or `@activity('NameofInnerActivity')[0].pipelineName`.
472+
## Aggregating outputs
476473

477-
**Array output details of all Iterations:**
478-
```json
479-
[
480-
{
481-
"pipelineName": "db1f7d2b-dbbd-4ea8-964e-0d9b2d3fe676",
482-
"jobId": "a43766cb-ba13-4c68-923a-8349af9a76a3",
483-
"activityRunId": "217526fa-0218-42f1-b85c-e0b4f7b170ce",
484-
"linkedServiceName": "ADFService",
485-
"status": "Succeeded",
486-
"statusCode": null,
487-
"output":
488-
{
489-
"progress": 100,
490-
"loguri": null,
491-
"dataRead": "6.00 Bytes",
492-
"dataWritten": "6.00 Bytes",
493-
"regionOrGateway": "West US",
494-
"details": "Data Read: 6.00 Bytes, Written: 6.00 Bytes",
495-
"copyDuration": "00:00:05",
496-
"dataVolume": "6.00 Bytes",
497-
"throughput": "1.16 Bytes/s",
498-
"totalDuration": "00:00:10"
499-
},
500-
"resumptionToken":
501-
{
502-
"ExecutionId": "217526fa-0218-42f1-b85c-e0b4f7b170ce",
503-
"ResumptionToken":
504-
{
505-
"in progress": "217526fa-0218-42f1-b85c-e0b4f7b170ce/wu/cloud/"
506-
},
507-
"ExtendedProperties":
508-
{
509-
"dataRead": "6.00 Bytes",
510-
"dataWritten": "6.00 Bytes",
511-
"regionOrGateway": "West US",
512-
"details": "Data Read: 6.00 Bytes, Written: 6.00 Bytes",
513-
"copyDuration": "00:00:05",
514-
"dataVolume": "6.00 Bytes",
515-
"throughput": "1.16 Bytes/s",
516-
"totalDuration": "00:00:10"
517-
}
518-
},
519-
"error": null,
520-
"executionStartTime": "2017-08-01T04:17:27.5747275Z",
521-
"executionEndTime": "2017-08-01T04:17:46.4224091Z",
522-
"duration": "00:00:18.8476816"
523-
},
524-
{
525-
"pipelineName": "db1f7d2b-dbbd-4ea8-964e-0d9b2d3fe676",
526-
"jobId": "54232-ba13-4c68-923a-8349af9a76a3",
527-
"activityRunId": "217526fa-0218-42f1-b85c-e0b4f7b170ce",
528-
"linkedServiceName": "ADFService",
529-
"status": "Succeeded",
530-
"statusCode": null,
531-
"output":
532-
{
533-
"progress": 100,
534-
"loguri": null,
535-
"dataRead": "6.00 Bytes",
536-
"dataWritten": "6.00 Bytes",
537-
"regionOrGateway": "West US",
538-
"details": "Data Read: 6.00 Bytes, Written: 6.00 Bytes",
539-
"copyDuration": "00:00:05",
540-
"dataVolume": "6.00 Bytes",
541-
"throughput": "1.16 Bytes/s",
542-
"totalDuration": "00:00:10"
543-
},
544-
"resumptionToken":
545-
{
546-
"ExecutionId": "217526fa-0218-42f1-b85c-e0b4f7b170ce",
547-
"ResumptionToken":
548-
{
549-
"in progress": "217526fa-0218-42f1-b85c-e0b4f7b170ce/wu/cloud/"
550-
},
551-
"ExtendedProperties":
552-
{
553-
"dataRead": "6.00 Bytes",
554-
"dataWritten": "6.00 Bytes",
555-
"regionOrGateway": "West US",
556-
"details": "Data Read: 6.00 Bytes, Written: 6.00 Bytes",
557-
"copyDuration": "00:00:05",
558-
"dataVolume": "6.00 Bytes",
559-
"throughput": "1.16 Bytes/s",
560-
"totalDuration": "00:00:10"
561-
}
562-
},
563-
"error": null,
564-
"executionStartTime": "2017-08-01T04:18:27.5747275Z",
565-
"executionEndTime": "2017-08-01T04:18:46.4224091Z",
566-
"duration": "00:00:18.8476816"
567-
}
568-
]
474+
To aggregate outputs of __foreach__ activity, please utilize _Variable_s and _Append Variable_ activity.
569475

570-
```
476+
First, declare an `array` _variable_ in the pipeline. Then, invoke _Append Variable_ activity inside each __foreach__ loop. Subsequently, you can retrieve the aggregation from your array.
571477

572478
## Limitations and workarounds
573479

0 commit comments

Comments
 (0)