gpt4 book ai didi

azure - 数据工厂 - 将 json 传递给 foreach 事件

转载 作者:行者123 更新时间:2023-12-03 01:59:34 25 4
gpt4 key购买 nike

在 DataFactory 中,我正在创建一个 ForEach 事件,在 Items 中我正在使用以下表达式:

enter image description here

    @createArray(json('{
"daily": {
"raw": [
{
"entity_name": "ent1",
"fetchXML_file": "raw/ent1.xml",
"destination_path_base": "/master/raw/ent1"
},
{
"entity_name": "ent2",
"fetchXML_file": "raw/ent2.xml",
"destination_path_base": "/master/raw/ent2"
},
{
"entity_name": "ent3",
"fetchXML_file": "raw/ent3.xml",
"destination_path_base": "/master/raw/ent3"
}
]
}
}
'))

我想使用 fetchXML_file 值,但它不起作用。

如果我这样写:@item().daily.raw[0].fetchXML_file 它将仅适用于 ent1,但我想使用所有值(ent1、ent2 和 ent3)

我想实现这个方法,因为它比创建参数然后修改json或向json添加更多东西“更干净”。

任何人都可以帮助实现这一目标吗?

非常感谢!

最佳答案

将项目传递给 For Each 事件 它应该采用数组格式。您的 create ArrayJson 函数将对象转换为数组,并且它不会迭代 raw- 数组。

要实现此目的,请执行以下步骤:

  1. 首先采用带有 items 的 foreach 事件作为表达式。 enter image description here
  • 在每个循环下,采用设置变量事件并创建一个数组类型变量来存储原始数组,其值为@item().daily.raw enter image description here输出: enter image description here
  • 然后为每个事件采取另一个现在迭代此数组。在项目中传递 @variables('demo') enter image description here
    • 现在,在这个 foreach 下,您将能够迭代原始数组并提取每个值获取XML_文件 enter image description here

    输出:

    enter image description here

    关于azure - 数据工厂 - 将 json 传递给 foreach 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76871761/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com