简体   繁体   中英

Iterate in Activity within ForEach activity Azure Data Factory

I have a MetaData activity and a foreach activity connected to it.

在此处输入图片说明

I run this ForEach activity sequentially and here is the item it iterates over:

在此处输入图片说明

I have a copy activity within this foreach activity:

在此处输入图片说明

So I have 4 childItems that I get from my meta data activity. And I need to set the folder name in data lake based on the childItem value. In order to access the Child Item I have to use the zero based index. Can I set it dynamically? I assumed there would be something since it is already in a loop and is running sequentially. So I would not have to do

@activity('GetMetaData').output.ChildItems[3].name

but use the index

@activity('GetMetaData').output.ChildItems[index].name

Based on the document ,you could refer to the properties inside the for-each activity by using @item().XXX ,instead @activity('GetMetaData').output.ChildItems[index].XXX . The items property is the collection and each item in the collection is referred to by using the @item() .

In the ForEach activity, provide an array to be iterated over for the property items." Use @item() to iterate over a single enumeration in ForEach activity. For example, if items is an array: [1, 2, 3], @item() returns 1 in the first iteration, 2 in the second iteration, and 3 in the third iteration.

Also,please see this marked answer : Azure Data Factory get data for "For Each"component from query

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM