Aggregate values in array variable

Marc Jenkins 20 Reputation points
2023-06-14T15:48:10.9+00:00

A pipeline has a Meta data activity ('Get list of files') that retrieves all of the child items' filenames from a Azure Blob Storage container, and the result passed to a foreach activity:

@activity('Get list of files').output.childItems

for each filename, a lookup activity looks up that file, and the row count is appended to an array variable ('itemCount') within the foreach activity:

@activity('Lookup file item').output.count

then outside of the loop, the final appended variable is output to an array variable, so the result is something like:

{
	"name": "totalCountArray",
	"value": [
		29,
		10,
		11
	]
}

How would you then aggregate the values in the array as a sum of integers? Expected result in the example would be "50"

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
{count} votes

Accepted answer
  1. Subashri Vasudevan 11,226 Reputation points
    2023-06-16T04:31:41.55+00:00

    Hello @Marc Jenkins

    Thanks for the clarification, and using MS Q&A portal.

    You can make use of foreach loop activity + couple of set variable activities to compute the sum of an array.

    Here is a video reference for that. Please go through and let us know if it helps.

    Thank you.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.