在 ForEach activity Azure 数据工厂中迭代 Activity

Iterate in Activity within ForEach activity Azure Data Factory

我有一个 MetaData activity 和一个 foreach activity 连接到它。

我 运行 这个 ForEach activity 按顺序,这是它迭代的项目:

我在这个 foreach 中有一个副本 activity activity:

所以我有 4 个从我的元数据中获得的子项 activity。我需要根据 childItem 值在数据湖中设置文件夹名称。为了访问子项,我必须使用基于零的索引。可以动态设置吗?我假设会有一些东西,因为它已经在一个循环中并且是 运行ning 顺序。所以我不必做

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

但使用索引

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

基于 document,您可以使用 @item().XXX 而不是 @activity('GetMetaData').output.ChildItems[index].XXX 来引用 for-each activity 中的属性。 items 属性 是集合,集合中的每个项目都使用 @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.

另外,请看这个标记的答案: