Azure 数据工厂从数组中获取对象属性

Azure data factory get object properties from array

我有一个获取元数据 activity,它获取 blob 容器下的所有子项。有文件和文件夹,但我只需要文件。所以在一个过滤器 activity 中,它只过滤类型 = 文件的项目。这是我从过滤器 activity:

中得到的
    Output
    {
        "ItemsCount": 4,
        "FilteredItemsCount": 3,
        "Value": [
            {
                "name": "BRAND MAPPING.csv",
                "type": "File"
            },
            {
                "name": "ChinaBIHRA.csv",
                "type": "File"
            },
            {
                "name": "ChinaBIHRA.csv_20201021121500",
                "type": "File"
            }
        ]
    }

因此返回了一个包含 3 个对象的数组。每个对象都有名称和类型属性。我只想将名称作为参数提供给存储过程 activity。我已经使用这个表达式来尝试获取一个逗号分隔的列表作为参数。

    @join(activity('Filter1').output.Value.name, ',')

并收到此错误:

            The expression 'join(activity('Filter1').output.Value.name, ',')' cannot be evaluated because property 'name' cannot be selected. Array elements can only be selected using an integer index.

那么我该如何实现呢?

您可以在过滤器 activity 之后为每个 activity 创建。在 For Each activity 中,附加文件名。

步骤:

1.create两个变量。

2.Setting 的每个 activity

3.Setting of Append Variable activity in For Each activity

4.Setting of 设置变量

改用下面的代码块

@concat('''',join(json(replace(replace(replace(replace(string(
activity('Filter1').output.Value)
            ,',"type":"File"','')
        ,'"name":','')
    ,'{','')
,'}','')),''','''),'''')

这将放弃使用多个活动,您可以使用现有的框架。