如何使用逻辑应用程序将数组值插入表中

时间:2019-11-27 10:14:39

标签: azure azure-devops azure-functions azure-web-sites azure-logic-apps

enter image description here(在收到http请求时)。我需要将数组值插入表中。在我的情况下,数组是必需的。

我使用了这些东西:当收到一个http请求并且我使用了 parse JSON (解析JSON),然后在每个循环中使用了插入实体,但是引发错误。如果有人知道如何实现,请让我知道答案。

我使用RRT的表达式为:body('Parse_JSON')['ResponseRequired'] [0] ['ResponseRequiredType']

json模式

{
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
    "AssetErrorCode": {
        "type": "string"
    },
    "AssetErrorDesc": {
        "type": "string"
    },
    "AssetId": {
        "type": "integer"
    },
    "CustomerId": {
        "type": "integer"
    },
    "ResponseRequired": {
        "items": [
            {
                "properties": {
                    "ResponseRequiredAdditionalData": {
                        "type": "string"
                    },
                    "ResponseRequiredAddress": {
                        "type": "string"
                    },
                    "ResponseRequiredFrequency": {
                        "type": "string"
                    },
                    "ResponseRequiredType": {
                        "type": "integer"
                    }
                },
                "required": [
                    "ResponseRequiredType",
                    "ResponseRequiredFrequency",
                    "ResponseRequiredAddress",
                    "ResponseRequiredAdditionalData"
                ],
                "type": "object"
            },
            {
                "properties": {
                    "ResponseRequiredAdditionalData": {
                        "type": "string"
                    },
                    "ResponseRequiredAddress": {
                        "type": "string"
                    },
                    "ResponseRequiredFrequency": {
                        "type": "string"
                    },
                    "ResponseRequiredType": {
                        "type": "integer"
                    }
                },
                "required": [
                    "ResponseRequiredType",
                    "ResponseRequiredFrequency",
                    "ResponseRequiredAddress",
                    "ResponseRequiredAdditionalData"
                ],
                "type": "object"
            },
            {
                "properties": {
                    "ResponseRequiredAdditionalData": {
                        "type": "string"
                    },
                    "ResponseRequiredAddress": {
                        "type": "string"
                    },
                    "ResponseRequiredFrequency": {
                        "type": "string"
                    },
                    "ResponseRequiredType": {
                        "type": "integer"
                    }
                },
                "required": [
                    "ResponseRequiredType",
                    "ResponseRequiredFrequency",
                    "ResponseRequiredAddress",
                    "ResponseRequiredAdditionalData"
                ],
                "type": "object"
            }
        ],
        "type": "array"
    },
    "ServiceKey": {
        "type": "string"
    }
},
"required": [
    "CustomerId",
    "ServiceKey",
    "AssetId",
    "AssetErrorCode",
    "AssetErrorDesc",
    "ResponseRequired"
],
"type": "object"

}

1 个答案:

答案 0 :(得分:0)

使用此表达式:items('For_each')?['ResponseRequiredAddress']

解决了问题