无法将值设置为变量,因此逻辑应用程序中始终取初始值

时间:2019-06-26 10:19:04

标签: azure azure-logic-apps

我有一个变量,我将默认值设置为0。

在for_each中,我将新值设置为startIndex变量,并在For_each中使用该变量,但仍使用旧的0值。

逻辑应用程序代码-

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "For_each_2": {
                "actions": {
                    "Set_variable_3": {
                        "inputs": {
                            "name": "output",
                            "value": "@{split(items('For_each_2'),':')[0]}:@{substring(variables('mydata'),variables('startindex'),int(split(items('For_each_2'),':')[1]))}"
                        },
                        "runAfter": {},
                        "type": "SetVariable"
                    },
                    "Set_variable_4": {
                        "inputs": {
                            "name": "startIndex",
                            "value": "@int(split(items('For_each_2'),':')[1])"
                        },
                        "runAfter": {
                            "Set_variable_3": [
                                "Succeeded"
                            ]
                        },
                        "type": "SetVariable"
                    }
                },
                "foreach": "@variables('splitvar')",
                "runAfter": {
                    "Initialize_variable_9": [
                        "Succeeded"
                    ]
                },
                "type": "Foreach"
            },
            "Initialize_variable_5": {
                "inputs": {
                    "variables": [
                        {
                            "name": "mydata",
                            "type": "String",
                            "value": "abcdefg"
                        }
                    ]
                },
                "runAfter": {},
                "type": "InitializeVariable"
            },
            "Initialize_variable_6": {
                "inputs": {
                    "variables": [
                        {
                            "name": "key",
                            "type": "String",
                            "value": "AA:3;BB:2"
                        }
                    ]
                },
                "runAfter": {
                    "Initialize_variable_5": [
                        "Succeeded"
                    ]
                },
                "type": "InitializeVariable"
            },
            "Initialize_variable_7": {
                "inputs": {
                    "variables": [
                        {
                            "name": "splitvar",
                            "type": "Array",
                            "value": "@split(variables('key'),';')"
                        }
                    ]
                },
                "runAfter": {
                    "Initialize_variable_6": [
                        "Succeeded"
                    ]
                },
                "type": "InitializeVariable"
            },
            "Initialize_variable_8": {
                "inputs": {
                    "variables": [
                        {
                            "name": "output",
                            "type": "String"
                        }
                    ]
                },
                "runAfter": {
                    "Initialize_variable_7": [
                        "Succeeded"
                    ]
                },
                "type": "InitializeVariable"
            },
            "Initialize_variable_9": {
                "inputs": {
                    "variables": [
                        {
                            "name": "startIndex",
                            "type": "Integer",
                            "value": 0
                        }
                    ]
                },
                "runAfter": {
                    "Initialize_variable_8": [
                        "Succeeded"
                    ]
                },
                "type": "InitializeVariable"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {},
        "triggers": {
            "manual": {
                "inputs": {
                    "schema": {}
                },
                "kind": "Http",
                "type": "Request"
            }
        }
    }
}

1 个答案:

答案 0 :(得分:1)

您需要为每个操作启用并发控制。默认情况下,每个操作都以Degree of Parallelism set to 20运行。因此,它作为默认行为并行运行操作20次。将其调低至1。

Settings[1]

Degree of Parallelism] 2