使用 JSON 为数据工厂中的每个循环提供数据

2023-12-15

数据工厂新手,我正在努力解决以下问题:

我有一个 Web 活动,它调用 API 并返回以下 JSON:

{
"ResponseCode": 200,
"ResponseText": "OK",
"Data": {
    "ramco_purchaseordershipment": "ramco_purchaseordershipment",
    "ramco_ramco_paymentschedule_cobalt_duesoption": "ramco_ramco_paymentschedule_cobalt_duesoption",
    "cobalt_accountingintegrationbatch": "cobalt_accountingintegrationbatch",
    "opportunitycompetitors": "OpportunityCompetitors"}

}

其中代表 Dynamics 365 DB 中的实体名称。

我将 For-Each 活动设置项添加到:

@array(activity('Web1').output.Data)

这最终给了我一个不是我想要的单个项目数组。

我想要完成的是迭代 ramco_purchaseordershipment、ramco_ramco_ paymentschedule_cobalt_duesoption 等,然后使用每个值作为参数触发另一个管道。

我知道这很愚蠢,但我整个下午都盯着它看,但没有运气。

Thanks!

Michael


我创建了一个简单的测试来实现这一目标。在这里,我使用查找活动返回与您的文件相同的 json 文件。
我的想法是:

  • 将此 json 对象转换为字符串。
  • Add },{到字符串。
  • 用逗号将其分割成字符串数组。
  • 最后遍历这个数组。
  • 将字符串转换为json对象,并传递给下一个管道的参数。
  1. Declare an array type variable. enter image description here

  2. Use expression @split(replace(string(activity('Lookup1').output.value[0].Data),',','},{'),',') to get the string array. Here you need to replace activity('Lookup1').output.value[0].Data with activity('Web1').output.Data.
    enter image description here

  3. Foreach the string array. enter image description here

  4. Add dynamic content @json(item()), it will parse string to json enter image description here

  5. 执行Pipeline1的输入如下:

    "parameters": {
        "Para1": {
            "ramco_purchaseordershipment": "ramco_purchaseordershipment"
        } 


    "parameters": {
        "Para1": {
            "ramco_ramco_paymentschedule_cobalt_duesoption": 
         "ramco_ramco_paymentschedule_cobalt_duesoption"
        }

    "parameters": {
        "Para1": {
            "cobalt_accountingintegrationbatch": "cobalt_accountingintegrationbatch"
        }

    "parameters": {
        "Para1": {
            "opportunitycompetitors": "OpportunityCompetitors"
        }
    }
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 JSON 为数据工厂中的每个循环提供数据 的相关文章

随机推荐